diff options
Diffstat (limited to 'ui/app/components/balance')
-rw-r--r-- | ui/app/components/balance/balance.component.js | 92 | ||||
-rw-r--r-- | ui/app/components/balance/balance.container.js | 32 | ||||
-rw-r--r-- | ui/app/components/balance/index.js | 1 |
3 files changed, 0 insertions, 125 deletions
diff --git a/ui/app/components/balance/balance.component.js b/ui/app/components/balance/balance.component.js deleted file mode 100644 index 9d0018add..000000000 --- a/ui/app/components/balance/balance.component.js +++ /dev/null @@ -1,92 +0,0 @@ -import React, { PureComponent } from 'react' -import PropTypes from 'prop-types' -import TokenBalance from '../token-balance' -import Identicon from '../identicon' -import UserPreferencedCurrencyDisplay from '../user-preferenced-currency-display' -import { PRIMARY, SECONDARY } from '../../constants/common' -import { formatBalance } from '../../util' - -export default class Balance extends PureComponent { - static propTypes = { - account: PropTypes.object, - assetImages: PropTypes.object, - nativeCurrency: PropTypes.string, - needsParse: PropTypes.bool, - network: PropTypes.string, - showFiat: PropTypes.bool, - token: PropTypes.object, - } - - static defaultProps = { - needsParse: true, - showFiat: true, - } - - renderBalance () { - const { account, nativeCurrency, needsParse, showFiat } = this.props - const balanceValue = account && account.balance - const formattedBalance = balanceValue - ? formatBalance(balanceValue, 6, needsParse, nativeCurrency) - : '...' - - if (formattedBalance === 'None' || formattedBalance === '...') { - return ( - <div className="flex-column balance-display"> - <div className="token-amount"> - { formattedBalance } - </div> - </div> - ) - } - - return ( - <div className="flex-column balance-display"> - <UserPreferencedCurrencyDisplay - className="token-amount" - value={balanceValue} - type={PRIMARY} - ethNumberOfDecimals={4} - /> - { - showFiat && ( - <UserPreferencedCurrencyDisplay - value={balanceValue} - type={SECONDARY} - ethNumberOfDecimals={4} - /> - ) - } - </div> - ) - } - - renderTokenBalance () { - const { token } = this.props - - return ( - <div className="flex-column balance-display"> - <div className="token-amount"> - <TokenBalance token={token} /> - </div> - </div> - ) - } - - render () { - const { token, network, assetImages } = this.props - const address = token && token.address - const image = assetImages && address ? assetImages[token.address] : undefined - - return ( - <div className="balance-container"> - <Identicon - diameter={50} - address={address} - network={network} - image={image} - /> - { token ? this.renderTokenBalance() : this.renderBalance() } - </div> - ) - } -} diff --git a/ui/app/components/balance/balance.container.js b/ui/app/components/balance/balance.container.js deleted file mode 100644 index 1cd6df5ce..000000000 --- a/ui/app/components/balance/balance.container.js +++ /dev/null @@ -1,32 +0,0 @@ -import { connect } from 'react-redux' -import Balance from './balance.component' -import { - getNativeCurrency, - getAssetImages, - conversionRateSelector, - getCurrentCurrency, - getMetaMaskAccounts, - getIsMainnet, - preferencesSelector, -} from '../../selectors' - -const mapStateToProps = state => { - const { showFiatInTestnets } = preferencesSelector(state) - const isMainnet = getIsMainnet(state) - const accounts = getMetaMaskAccounts(state) - const network = state.metamask.network - const selectedAddress = state.metamask.selectedAddress || Object.keys(accounts)[0] - const account = accounts[selectedAddress] - - return { - account, - network, - nativeCurrency: getNativeCurrency(state), - conversionRate: conversionRateSelector(state), - currentCurrency: getCurrentCurrency(state), - assetImages: getAssetImages(state), - showFiat: (isMainnet || !!showFiatInTestnets), - } -} - -export default connect(mapStateToProps)(Balance) diff --git a/ui/app/components/balance/index.js b/ui/app/components/balance/index.js deleted file mode 100644 index f8fb9ea19..000000000 --- a/ui/app/components/balance/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './balance.container' |