import React, { PureComponent } from 'react' import PropTypes from 'prop-types' import Button from '../button' import Identicon from '../identicon' import TokenBalance from '../token-balance' import { SEND_ROUTE } from '../../routes' import { formatCurrency } from '../../helpers/confirm-transaction/util' export default class TokenViewBalance extends PureComponent { static contextTypes = { t: PropTypes.func, } static propTypes = { showDepositModal: PropTypes.func, selectedToken: PropTypes.object, history: PropTypes.object, network: PropTypes.string, ethBalance: PropTypes.string, fiatBalance: PropTypes.string, currentCurrency: PropTypes.string, } renderBalance () { const { selectedToken, ethBalance, fiatBalance, currentCurrency } = this.props const formattedFiatBalance = formatCurrency(fiatBalance, currentCurrency) return selectedToken ? ( ) : (
{ `${ethBalance} ETH` }
{ formattedFiatBalance }
) } renderButtons () { const { t } = this.context const { selectedToken, showDepositModal, history } = this.props return (
{ !selectedToken && ( ) }
) } render () { const { network, selectedToken } = this.props return (
{ this.renderBalance() }
{ this.renderButtons() }
) } }