|
|
@ -1,11 +1,13 @@ |
|
|
|
import React, { PureComponent } from 'react' |
|
|
|
import React, { PureComponent } from 'react' |
|
|
|
import PropTypes from 'prop-types' |
|
|
|
import PropTypes from 'prop-types' |
|
|
|
|
|
|
|
import classnames from 'classnames' |
|
|
|
import Button from '../button' |
|
|
|
import Button from '../button' |
|
|
|
import Identicon from '../identicon' |
|
|
|
import Identicon from '../identicon' |
|
|
|
import TokenBalance from '../token-balance' |
|
|
|
import TokenBalance from '../token-balance' |
|
|
|
import UserPreferencedCurrencyDisplay from '../user-preferenced-currency-display' |
|
|
|
import UserPreferencedCurrencyDisplay from '../user-preferenced-currency-display' |
|
|
|
import { SEND_ROUTE } from '../../routes' |
|
|
|
import { SEND_ROUTE } from '../../routes' |
|
|
|
import { PRIMARY, SECONDARY } from '../../constants/common' |
|
|
|
import { PRIMARY, SECONDARY } from '../../constants/common' |
|
|
|
|
|
|
|
import Tooltip from '../tooltip-v2' |
|
|
|
|
|
|
|
|
|
|
|
export default class TransactionViewBalance extends PureComponent { |
|
|
|
export default class TransactionViewBalance extends PureComponent { |
|
|
|
static contextTypes = { |
|
|
|
static contextTypes = { |
|
|
@ -19,10 +21,11 @@ export default class TransactionViewBalance extends PureComponent { |
|
|
|
network: PropTypes.string, |
|
|
|
network: PropTypes.string, |
|
|
|
balance: PropTypes.string, |
|
|
|
balance: PropTypes.string, |
|
|
|
assetImage: PropTypes.string, |
|
|
|
assetImage: PropTypes.string, |
|
|
|
|
|
|
|
balanceIsCached: PropTypes.bool, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
renderBalance () { |
|
|
|
renderBalance () { |
|
|
|
const { selectedToken, balance } = this.props |
|
|
|
const { selectedToken, balance, balanceIsCached } = this.props |
|
|
|
|
|
|
|
|
|
|
|
return selectedToken |
|
|
|
return selectedToken |
|
|
|
? ( |
|
|
|
? ( |
|
|
@ -34,20 +37,34 @@ export default class TransactionViewBalance extends PureComponent { |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
) : ( |
|
|
|
) : ( |
|
|
|
<div className="transaction-view-balance__balance"> |
|
|
|
<Tooltip position="top" title={this.context.t('balanceOutdated')} disabled={!balanceIsCached}> |
|
|
|
<UserPreferencedCurrencyDisplay |
|
|
|
<div className="transaction-view-balance__balance"> |
|
|
|
className="transaction-view-balance__primary-balance" |
|
|
|
<div className="transaction-view-balance__primary-container"> |
|
|
|
value={balance} |
|
|
|
<UserPreferencedCurrencyDisplay |
|
|
|
type={PRIMARY} |
|
|
|
className={classnames('transaction-view-balance__primary-balance', { |
|
|
|
ethNumberOfDecimals={4} |
|
|
|
'transaction-view-balance__cached-balance': balanceIsCached, |
|
|
|
/> |
|
|
|
})} |
|
|
|
<UserPreferencedCurrencyDisplay |
|
|
|
value={balance} |
|
|
|
className="transaction-view-balance__secondary-balance" |
|
|
|
type={PRIMARY} |
|
|
|
value={balance} |
|
|
|
ethNumberOfDecimals={4} |
|
|
|
type={SECONDARY} |
|
|
|
hideTitle={true} |
|
|
|
ethNumberOfDecimals={4} |
|
|
|
/> |
|
|
|
/> |
|
|
|
{ |
|
|
|
</div> |
|
|
|
balanceIsCached ? <span className="transaction-view-balance__cached-star">*</span> : null |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<UserPreferencedCurrencyDisplay |
|
|
|
|
|
|
|
className={classnames({ |
|
|
|
|
|
|
|
'transaction-view-balance__cached-secondary-balance': balanceIsCached, |
|
|
|
|
|
|
|
'transaction-view-balance__secondary-balance': !balanceIsCached, |
|
|
|
|
|
|
|
})} |
|
|
|
|
|
|
|
value={balance} |
|
|
|
|
|
|
|
type={SECONDARY} |
|
|
|
|
|
|
|
ethNumberOfDecimals={4} |
|
|
|
|
|
|
|
hideTitle={true} |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</Tooltip> |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|