1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-17 23:13:21 +01:00

Hide fiat values on account details screen when eth/token value is 0.

This commit is contained in:
Dan 2017-12-19 14:02:32 -03:30 committed by Chi Kei Chan
parent 0feb5b210b
commit 109e4e5d96
3 changed files with 8 additions and 3 deletions

View File

@ -94,7 +94,8 @@ BalanceComponent.prototype.renderFiatValue = function (formattedBalance) {
} }
BalanceComponent.prototype.renderFiatAmount = function (fiatDisplayNumber, fiatSuffix, fiatPrefix) { BalanceComponent.prototype.renderFiatAmount = function (fiatDisplayNumber, fiatSuffix, fiatPrefix) {
if (fiatDisplayNumber === 'N/A') return null const shouldNotRenderFiat = fiatDisplayNumber === 'N/A' || Number(fiatDisplayNumber) === 0
if (shouldNotRenderFiat) return null
return h('div.fiat-amount', { return h('div.fiat-amount', {
style: {}, style: {},

View File

@ -86,7 +86,9 @@ TokenCell.prototype.render = function () {
numberOfDecimals: 2, numberOfDecimals: 2,
conversionRate: currentTokenToFiatRate, conversionRate: currentTokenToFiatRate,
}) })
formattedFiat = `${currentTokenInFiat} ${currentCurrency.toUpperCase()}` formattedFiat = currentTokenInFiat.toString() === '0'
? ''
: `${currentTokenInFiat} ${currentCurrency.toUpperCase()}`
} }
const showFiat = Boolean(currentTokenInFiat) && currentCurrency.toUpperCase() !== symbol const showFiat = Boolean(currentTokenInFiat) && currentCurrency.toUpperCase() !== symbol

View File

@ -170,6 +170,7 @@ TxListItem.prototype.getSendTokenTotal = async function () {
TxListItem.prototype.render = function () { TxListItem.prototype.render = function () {
const { const {
transactionStatus, transactionStatus,
transactionAmount,
onClick, onClick,
transActionId, transActionId,
dateString, dateString,
@ -177,6 +178,7 @@ TxListItem.prototype.render = function () {
className, className,
} = this.props } = this.props
const { total, fiatTotal } = this.state const { total, fiatTotal } = this.state
const showFiatTotal = transactionAmount !== '0x0' && fiatTotal
return h(`div${className || ''}`, { return h(`div${className || ''}`, {
key: transActionId, key: transActionId,
@ -238,7 +240,7 @@ TxListItem.prototype.render = function () {
}), }),
}, total), }, total),
fiatTotal && h('span.tx-list-fiat-value', fiatTotal), showFiatTotal && h('span.tx-list-fiat-value', fiatTotal),
]), ]),
]), ]),