Show fiat balance on token page (#8791)

The token page overview now shows the balance in fiat.
feature/default_network_editable
Mark Stacey 4 years ago committed by GitHub
parent a100c55e64
commit cf08131b49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      ui/app/components/app/wallet-overview/index.scss
  2. 23
      ui/app/components/app/wallet-overview/token-overview.js

@ -102,6 +102,13 @@
justify-content: center;
}
&__secondary-balance {
font-size: 16px;
line-height: 23px;
font-weight: 400;
color: $Grey-400;
}
&__button {
min-width: initial;
width: 100px;

@ -5,11 +5,13 @@ import { useHistory } from 'react-router-dom'
import Button from '../../ui/button'
import Identicon from '../../ui/identicon'
import TokenBalance from '../../ui/token-balance'
import CurrencyDisplay from '../../ui/currency-display'
import { I18nContext } from '../../../contexts/i18n'
import WalletOverview from './wallet-overview'
import { SEND_ROUTE } from '../../../helpers/constants/routes'
import { useMetricEvent } from '../../../hooks/useMetricEvent'
import { useTokenTracker } from '../../../hooks/useTokenTracker'
import { useTokenFiatAmount } from '../../../hooks/useTokenFiatAmount'
import { getAssetImages } from '../../../selectors/selectors'
import { updateSendToken } from '../../../store/actions'
@ -25,15 +27,30 @@ const TokenOverview = ({ className, token }) => {
})
const history = useHistory()
const assetImages = useSelector(getAssetImages)
const { tokensWithBalances } = useTokenTracker([token])
const balance = tokensWithBalances[0]?.string
const formattedFiatBalance = useTokenFiatAmount(token.address, balance, token.symbol)
return (
<WalletOverview
balance={(
<div className="token-overview__balance">
<TokenBalance
<CurrencyDisplay
className="token-overview__primary-balance"
token={token}
displayValue={balance}
suffix={token.symbol}
/>
{
formattedFiatBalance
? (
<CurrencyDisplay
className="token-overview__secondary-balance"
displayValue={formattedFiatBalance}
hideLabel
/>
)
: null
}
</div>
)}
buttons={(

Loading…
Cancel
Save