From d6bf24902a34f2094363121c8d9f4d54db6f7b6c Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Fri, 28 Apr 2017 23:28:27 +0200 Subject: implement new reserve creation dialog and auditor management --- src/pages/auditors.tsx | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'src/pages/auditors.tsx') diff --git a/src/pages/auditors.tsx b/src/pages/auditors.tsx index 41339b0d8..762d22ad8 100644 --- a/src/pages/auditors.tsx +++ b/src/pages/auditors.tsx @@ -23,6 +23,7 @@ import { ExchangeRecord, + ExchangeForCurrencyRecord, DenominationRecord, AuditorRecord, CurrencyRecord, @@ -65,13 +66,20 @@ class CurrencyList extends React.Component { this.setState({ currencies }); } - async confirmRemove(c: CurrencyRecord, a: AuditorRecord) { + async confirmRemoveAuditor(c: CurrencyRecord, a: AuditorRecord) { if (window.confirm(`Do you really want to remove auditor ${a.baseUrl} for currency ${c.name}?`)) { c.auditors = c.auditors.filter((x) => x.auditorPub != a.auditorPub); await updateCurrency(c); } } + async confirmRemoveExchange(c: CurrencyRecord, e: ExchangeForCurrencyRecord) { + if (window.confirm(`Do you really want to remove exchange ${e.baseUrl} for currency ${c.name}?`)) { + c.exchanges = c.exchanges.filter((x) => x.baseUrl != e.baseUrl); + await updateCurrency(c); + } + } + renderAuditors(c: CurrencyRecord): any { if (c.auditors.length == 0) { return

No trusted auditors for this currency.

@@ -81,7 +89,7 @@ class CurrencyList extends React.Component {

Trusted Auditors:

    {c.auditors.map(a => ( -
  • {a.baseUrl} +
  • {a.baseUrl}
    • valid until {new Date(a.expirationStamp).toString()}
    • public key {a.auditorPub}
    • @@ -93,6 +101,23 @@ class CurrencyList extends React.Component { ); } + renderExchanges(c: CurrencyRecord): any { + if (c.exchanges.length == 0) { + return

      No trusted exchanges for this currency.

      + } + return ( +
      +

      Trusted Exchanges:

      +
        + {c.exchanges.map(e => ( +
      • {e.baseUrl} +
      • + ))} +
      +
      + ); + } + render(): JSX.Element { let currencies = this.state.currencies; if (!currencies) { @@ -104,7 +129,10 @@ class CurrencyList extends React.Component {

      Currency {c.name}

      Displayed with {c.fractionalDigits} fractional digits.

      +

      Auditors

      {this.renderAuditors(c)}
      +

      Exchanges

      +
      {this.renderExchanges(c)}
      ))} -- cgit v1.2.3