diff options
Diffstat (limited to 'ui/app/components/token-currency-display/token-currency-display.component.js')
-rw-r--r-- | ui/app/components/token-currency-display/token-currency-display.component.js | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/ui/app/components/token-currency-display/token-currency-display.component.js b/ui/app/components/token-currency-display/token-currency-display.component.js deleted file mode 100644 index 4bb09a4b6..000000000 --- a/ui/app/components/token-currency-display/token-currency-display.component.js +++ /dev/null @@ -1,54 +0,0 @@ -import React, { PureComponent } from 'react' -import PropTypes from 'prop-types' -import CurrencyDisplay from '../currency-display/currency-display.component' -import { getTokenData } from '../../helpers/transactions.util' -import { getTokenValue, calcTokenAmount } from '../../token-util' - -export default class TokenCurrencyDisplay extends PureComponent { - static propTypes = { - transactionData: PropTypes.string, - token: PropTypes.object, - } - - state = { - displayValue: '', - } - - componentDidMount () { - this.setDisplayValue() - } - - componentDidUpdate (prevProps) { - const { transactionData } = this.props - const { transactionData: prevTransactionData } = prevProps - - if (transactionData !== prevTransactionData) { - this.setDisplayValue() - } - } - - setDisplayValue () { - const { transactionData: data, token } = this.props - const { decimals = '', symbol = '' } = token - const tokenData = getTokenData(data) - - let displayValue - - if (tokenData.params && tokenData.params.length) { - const tokenValue = getTokenValue(tokenData.params) - const tokenAmount = calcTokenAmount(tokenValue, decimals) - displayValue = `${tokenAmount} ${symbol}` - } - - this.setState({ displayValue }) - } - - render () { - return ( - <CurrencyDisplay - {...this.props} - displayValue={this.state.displayValue} - /> - ) - } -} |