@@ -12,6 +12,9 @@ import { Wei } from 'libs/units';
12
12
import { AppState } from 'reducers' ;
13
13
import { getNetworkConfig , getOffline } from 'selectors/config' ;
14
14
import { connect } from 'react-redux' ;
15
+ import btcIco from 'assets/images/bitcoin.png' ;
16
+ import ethIco from 'assets/images/ether.png' ;
17
+ import repIco from 'assets/images/augur.png' ;
15
18
import { NetworkConfig } from 'types/network' ;
16
19
17
20
interface AllValue {
@@ -116,9 +119,22 @@ class EquivalentValues extends React.Component<Props, State> {
116
119
const isFetching =
117
120
! balance || balance . isPending || ! tokenBalances || Object . keys ( rates ) . length === 0 ;
118
121
const pairRates = this . generateValues ( equivalentValues . label , equivalentValues . value ) ;
122
+ const fiatSymbols = {
123
+ USD : '$' ,
124
+ EUR : '€' ,
125
+ GBP : '£' ,
126
+ CHF : ' '
127
+ } ;
128
+ const coinAndTokenSymbols = {
129
+ BTC : btcIco ,
130
+ ETH : ethIco ,
131
+ REP : repIco
132
+ } ;
119
133
120
- const Value = ( { rate, value } ) => (
121
- < div className = "EquivalentValues-values-currency" >
134
+ const Value = ( { className = '' , rate, value, symbol = '' , icon = '' } ) => (
135
+ < div className = { `EquivalentValues-values-currency ${ className } ` } >
136
+ < img src = { icon } />
137
+ { ! ! symbol && < span className = "EquivalentValues-values-currency-fiat-symbol" > { symbol } </ span > }
122
138
< span className = "EquivalentValues-values-currency-label" > { rate } </ span > { ' ' }
123
139
< span className = "EquivalentValues-values-currency-value" >
124
140
< UnitDisplay
@@ -165,7 +181,33 @@ class EquivalentValues extends React.Component<Props, State> {
165
181
) : (
166
182
< div className = "EquivalentValues-values" >
167
183
{ pairRates . length ? (
168
- pairRates . map ( ( equiv , i ) => < Value rate = { equiv . rate } value = { equiv . value } key = { i } /> )
184
+ < React . Fragment >
185
+ { pairRates . map (
186
+ ( equiv , i ) =>
187
+ ( rateSymbols . symbols . fiat as string [ ] ) . includes ( equiv . rate ) && (
188
+ < Value
189
+ className = "EquivalentValues-values-currency-fiat"
190
+ rate = { equiv . rate }
191
+ value = { equiv . value }
192
+ symbol = { fiatSymbols [ equiv . rate ] }
193
+ key = { i }
194
+ />
195
+ )
196
+ ) }
197
+ < div className = "EquivalentValues-values-spacer" />
198
+ { pairRates . map (
199
+ ( equiv , i ) =>
200
+ ( rateSymbols . symbols . coinAndToken as string [ ] ) . includes ( equiv . rate ) && (
201
+ < Value
202
+ className = "EquivalentValues-values-currency-coin-and-token"
203
+ rate = { equiv . rate }
204
+ value = { equiv . value }
205
+ icon = { coinAndTokenSymbols [ equiv . rate ] }
206
+ key = { i }
207
+ />
208
+ )
209
+ ) }
210
+ </ React . Fragment >
169
211
) : (
170
212
< p > Sorry, equivalent values are not supported for this unit.</ p >
171
213
) }
0 commit comments