diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-04-28 23:28:27 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-04-28 23:28:27 +0200 |
commit | d6bf24902a34f2094363121c8d9f4d54db6f7b6c (patch) | |
tree | 0794956ebdf91a2fbea16baa0e8aa559f45c5d06 /src/pages/auditors.tsx | |
parent | ce97b1076b7e4a53b84d3fd34bf2047580ddeb22 (diff) |
implement new reserve creation dialog and auditor management
Diffstat (limited to 'src/pages/auditors.tsx')
-rw-r--r-- | src/pages/auditors.tsx | 32 |
1 files changed, 30 insertions, 2 deletions
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<any, CurrencyListState> { 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 <p>No trusted auditors for this currency.</p> @@ -81,7 +89,7 @@ class CurrencyList extends React.Component<any, CurrencyListState> { <p>Trusted Auditors:</p> <ul> {c.auditors.map(a => ( - <li>{a.baseUrl} <button className="pure-button button-destructive" onClick={() => this.confirmRemove(c, a)}>Remove</button> + <li>{a.baseUrl} <button className="pure-button button-destructive" onClick={() => this.confirmRemoveAuditor(c, a)}>Remove</button> <ul> <li>valid until {new Date(a.expirationStamp).toString()}</li> <li>public key {a.auditorPub}</li> @@ -93,6 +101,23 @@ class CurrencyList extends React.Component<any, CurrencyListState> { ); } + renderExchanges(c: CurrencyRecord): any { + if (c.exchanges.length == 0) { + return <p>No trusted exchanges for this currency.</p> + } + return ( + <div> + <p>Trusted Exchanges:</p> + <ul> + {c.exchanges.map(e => ( + <li>{e.baseUrl} <button className="pure-button button-destructive" onClick={() => this.confirmRemoveExchange(c, e)}>Remove</button> + </li> + ))} + </ul> + </div> + ); + } + render(): JSX.Element { let currencies = this.state.currencies; if (!currencies) { @@ -104,7 +129,10 @@ class CurrencyList extends React.Component<any, CurrencyListState> { <div> <h1>Currency {c.name}</h1> <p>Displayed with {c.fractionalDigits} fractional digits.</p> + <h2>Auditors</h2> <div>{this.renderAuditors(c)}</div> + <h2>Exchanges</h2> + <div>{this.renderExchanges(c)}</div> </div> ))} </div> |