Handle unsupported units in EquivalentValues (#939)

This commit is contained in:
Daniel Ternyak 2018-01-29 12:23:39 -06:00 committed by GitHub
parent 13ad2ada84
commit d661f0ff5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -113,6 +113,7 @@ class EquivalentValues extends React.Component<Props, State> {
const { equivalentValues, options } = this.state;
const isFetching =
!balance || balance.isPending || !tokenBalances || Object.keys(rates).length === 0;
const pairRates = this.generateValues(equivalentValues.label, equivalentValues.value);
const Value = ({ rate, value }) => (
<div className="EquivalentValues-values-currency">
@ -159,9 +160,11 @@ class EquivalentValues extends React.Component<Props, State> {
<Spinner size="x2" />
) : (
<div className="EquivalentValues-values">
{this.generateValues(equivalentValues.label, equivalentValues.value).map((equiv, i) => (
<Value rate={equiv.rate} value={equiv.value} key={i} />
))}
{pairRates.length ? (
pairRates.map((equiv, i) => <Value rate={equiv.rate} value={equiv.value} key={i} />)
) : (
<p>Sorry, equivalent values are not supported for this unit.</p>
)}
</div>
)}
</div>