|
|
|
@ -15,6 +15,7 @@ type Props = {
|
|
|
|
|
network: Network,
|
|
|
|
|
balance: string,
|
|
|
|
|
fiat: $ElementType<ReducersState, 'fiat'>,
|
|
|
|
|
localCurrency: string,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
type State = {
|
|
|
|
@ -59,6 +60,7 @@ const FiatValue = styled.div`
|
|
|
|
|
min-height: 25px;
|
|
|
|
|
color: ${colors.TEXT_PRIMARY};
|
|
|
|
|
align-items: center;
|
|
|
|
|
text-transform: uppercase;
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
const FiatValueRate = styled.div`
|
|
|
|
@ -69,6 +71,7 @@ const FiatValueRate = styled.div`
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
color: ${colors.TEXT_PRIMARY};
|
|
|
|
|
text-transform: uppercase;
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
const BalanceWrapper = styled.div`
|
|
|
|
@ -116,14 +119,14 @@ class AccountBalance extends PureComponent<Props, State> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
|
const { network } = this.props;
|
|
|
|
|
const { network, localCurrency } = this.props;
|
|
|
|
|
const fiatRate = this.props.fiat.find(f => f.network === network.shortcut);
|
|
|
|
|
let accountBalance = '';
|
|
|
|
|
let fiatRateValue = '';
|
|
|
|
|
let fiat = '';
|
|
|
|
|
if (fiatRate) {
|
|
|
|
|
accountBalance = new BigNumber(this.props.balance);
|
|
|
|
|
fiatRateValue = new BigNumber(fiatRate.value).toFixed(2);
|
|
|
|
|
fiatRateValue = new BigNumber(fiatRate.rates[localCurrency]).toFixed(2);
|
|
|
|
|
fiat = accountBalance.times(fiatRateValue).toFixed(2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -155,7 +158,9 @@ class AccountBalance extends PureComponent<Props, State> {
|
|
|
|
|
<FormattedMessage {...l10nMessages.TR_BALANCE} />
|
|
|
|
|
</Label>
|
|
|
|
|
<TooltipWrapper>
|
|
|
|
|
<FiatValue>{fiatRate ? `$ ${fiat}` : 'N/A'}</FiatValue>
|
|
|
|
|
<FiatValue>
|
|
|
|
|
{fiatRate ? `${fiat} ${localCurrency}` : 'N/A'}
|
|
|
|
|
</FiatValue>
|
|
|
|
|
{!fiatRate && NoRatesTooltip}
|
|
|
|
|
</TooltipWrapper>
|
|
|
|
|
<CoinBalance>
|
|
|
|
@ -168,7 +173,7 @@ class AccountBalance extends PureComponent<Props, State> {
|
|
|
|
|
</Label>
|
|
|
|
|
<TooltipWrapper>
|
|
|
|
|
<FiatValueRate>
|
|
|
|
|
{fiatRate ? `$ ${fiatRateValue}` : 'N/A'}
|
|
|
|
|
{fiatRate ? `${fiatRateValue} ${localCurrency}` : 'N/A'}
|
|
|
|
|
</FiatValueRate>
|
|
|
|
|
{!fiatRate && NoRatesTooltip}
|
|
|
|
|
</TooltipWrapper>
|
|
|
|
|