From fd51ab12298e93286eeaf03c60e0b4e8d5d1bad3 Mon Sep 17 00:00:00 2001 From: Alexander Tseung Date: Fri, 31 Aug 2018 12:36:07 -0700 Subject: Add TransactionBreakdown component --- .../transaction-breakdown.component.js | 82 ++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 ui/app/components/transaction-breakdown/transaction-breakdown.component.js (limited to 'ui/app/components/transaction-breakdown/transaction-breakdown.component.js') diff --git a/ui/app/components/transaction-breakdown/transaction-breakdown.component.js b/ui/app/components/transaction-breakdown/transaction-breakdown.component.js new file mode 100644 index 000000000..a168b53dc --- /dev/null +++ b/ui/app/components/transaction-breakdown/transaction-breakdown.component.js @@ -0,0 +1,82 @@ +import React, { PureComponent } from 'react' +import PropTypes from 'prop-types' +import classnames from 'classnames' +import TransactionBreakdownRow from './transaction-breakdown-row' +import Card from '../card' +import CurrencyDisplay from '../currency-display' +import HexToDecimal from '../hex-to-decimal' +import { ETH, GWEI } from '../../constants/common' +import { getHexGasTotal } from '../../helpers/confirm-transaction/util' +import { addHex } from '../../helpers/transactions.util' + +export default class TransactionBreakdown extends PureComponent { + static contextTypes = { + t: PropTypes.func, + } + + static propTypes = { + transaction: PropTypes.object, + className: PropTypes.string, + } + + static defaultProps = { + transaction: {}, + } + + render () { + const { t } = this.context + const { transaction, className } = this.props + const { txParams: { gas, gasPrice, value } = {} } = transaction + const hexGasTotal = getHexGasTotal({ gasLimit: gas, gasPrice }) + const totalInHex = addHex(hexGasTotal, value) + + return ( +
+ + + + + + + + + + + +
+ + +
+
+
+
+ ) + } +} -- cgit