import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; import classnames from 'classnames'; import CurrencyDisplay from '../../ui/currency-display'; import UserPreferencedCurrencyDisplay from '../user-preferenced-currency-display'; import HexToDecimal from '../../ui/hex-to-decimal'; import { GWEI, PRIMARY, SECONDARY } from '../../../helpers/constants/common'; import TransactionBreakdownRow from './transaction-breakdown-row'; export default class TransactionBreakdown extends PureComponent { static contextTypes = { t: PropTypes.func, }; static propTypes = { className: PropTypes.string, nativeCurrency: PropTypes.string, showFiat: PropTypes.bool, nonce: PropTypes.string, primaryCurrency: PropTypes.string, isTokenApprove: PropTypes.bool, gas: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), gasPrice: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), gasUsed: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), totalInHex: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), }; static defaultProps = { showFiat: true, }; render() { const { t } = this.context; const { gas, gasPrice, primaryCurrency, className, nonce, nativeCurrency, showFiat, totalInHex, gasUsed, isTokenApprove, } = this.props; return (
{t('transaction')}
{typeof nonce === 'undefined' ? null : ( )} {primaryCurrency} {typeof gas === 'undefined' ? ( '?' ) : ( )} {typeof gasUsed === 'string' && ( )} {typeof gasPrice === 'undefined' ? ( '?' ) : ( )}
{showFiat && ( )}
); } }