mirror of
https://github.com/trezor/trezor-wallet
synced 2025-02-02 03:11:18 +00:00
show value in local currency in the left menu
This commit is contained in:
parent
f6dc375dd0
commit
1b3a363fd6
@ -9,6 +9,7 @@ import * as stateUtils from 'reducers/utils';
|
|||||||
import Tooltip from 'components/Tooltip';
|
import Tooltip from 'components/Tooltip';
|
||||||
import ICONS from 'config/icons';
|
import ICONS from 'config/icons';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
|
import { toFiatCurrency } from 'utils/fiatConverter';
|
||||||
|
|
||||||
import { NavLink } from 'react-router-dom';
|
import { NavLink } from 'react-router-dom';
|
||||||
import { findDeviceAccounts } from 'reducers/AccountsReducer';
|
import { findDeviceAccounts } from 'reducers/AccountsReducer';
|
||||||
@ -104,8 +105,6 @@ const AccountMenu = (props: Props) => {
|
|||||||
|
|
||||||
if (!selected || !network) return null;
|
if (!selected || !network) return null;
|
||||||
|
|
||||||
const fiatRate = props.fiat.find(f => f.network === network.shortcut);
|
|
||||||
|
|
||||||
const deviceAccounts: Accounts = findDeviceAccounts(accounts, selected, location.state.network);
|
const deviceAccounts: Accounts = findDeviceAccounts(accounts, selected, location.state.network);
|
||||||
|
|
||||||
const selectedAccounts = deviceAccounts.map((account, i) => {
|
const selectedAccounts = deviceAccounts.map((account, i) => {
|
||||||
@ -121,10 +120,13 @@ const AccountMenu = (props: Props) => {
|
|||||||
.toString(10);
|
.toString(10);
|
||||||
|
|
||||||
balance = `${availableBalance} ${network.symbol}`;
|
balance = `${availableBalance} ${network.symbol}`;
|
||||||
if (fiatRate) {
|
const fiatRates = props.fiat.find(f => f.network === network.shortcut);
|
||||||
const accountBalance = new BigNumber(availableBalance);
|
if (fiatRates) {
|
||||||
const fiat = accountBalance.times(fiatRate.value).toFixed(2);
|
const { localCurrency } = props.wallet;
|
||||||
balance = `${availableBalance} ${network.symbol} / $${fiat}`;
|
const fiat = toFiatCurrency(availableBalance, localCurrency, fiatRates.rates);
|
||||||
|
balance = `${availableBalance} ${
|
||||||
|
network.symbol
|
||||||
|
} / ${localCurrency.toUpperCase()} ${fiat}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user