From a77a5f0ab329433404893ff1280fb90ff2a12029 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Mon, 27 Feb 2017 13:53:43 -0800 Subject: Move input boxes into table and into details component. --- ui/app/components/hex-as-decimal-input.js | 5 ++++- ui/app/components/pending-tx-details.js | 35 +++++++++++++++++++++++++++++++ ui/app/components/pending-tx.js | 16 -------------- 3 files changed, 39 insertions(+), 17 deletions(-) (limited to 'ui/app') diff --git a/ui/app/components/hex-as-decimal-input.js b/ui/app/components/hex-as-decimal-input.js index 4d3105b8d..34f628f7f 100644 --- a/ui/app/components/hex-as-decimal-input.js +++ b/ui/app/components/hex-as-decimal-input.js @@ -27,6 +27,10 @@ HexAsDecimalInput.prototype.render = function () { return ( h('input', { + style: { + display: 'block', + textAlign: 'right', + }, value: decimalValue, onChange: (event) => { const hexString = hexify(event.target.value) @@ -46,4 +50,3 @@ function decimalize (input) { const inputBN = new BN(strippedInput, 'hex') return inputBN.toString(10) } - diff --git a/ui/app/components/pending-tx-details.js b/ui/app/components/pending-tx-details.js index e8615404e..973f6ac92 100644 --- a/ui/app/components/pending-tx-details.js +++ b/ui/app/components/pending-tx-details.js @@ -7,6 +7,8 @@ const EthBalance = require('./eth-balance') const util = require('../util') const addressSummary = util.addressSummary const nameForAddress = require('../../lib/contract-namer') +const HexInput = require('./hex-as-decimal-input') + module.exports = PendingTxDetails @@ -20,6 +22,7 @@ const PTXP = PendingTxDetails.prototype PTXP.render = function () { var props = this.props var txData = props.txData + var state = this.state || {} var txParams = txData.txParams || {} var address = txParams.from || props.selectedAddress @@ -27,6 +30,9 @@ PTXP.render = function () { var account = props.accounts[address] var balance = account ? account.balance : '0x0' + const gas = state.gas || txParams.gas + const gasPrice = state.gasPrice || txData.gasPrice + var txFee = txData.txFee || '' var maxCost = txData.maxCost || '' var dataLength = txParams.data ? (txParams.data.length - 2) / 2 : 0 @@ -129,7 +135,36 @@ PTXP.render = function () { }), ]), ]), + h('.cell.row', { + }, [ + h('.cell.label', 'Total Gas'), + h('.cell.value', { + + }, [ + h(HexInput, { + value: gas, + onChange: (newHex) => { + this.setState({ gas: newHex }) + }, + }), + ]) + ]), + h('.cell.row', { + + }, [ + h('.cell.label', 'Gas Price'), + h('.cell.value', { + + }, [ + h(HexInput, { + value: gasPrice, + onChange: (newHex) => { + this.setState({ gas: newHex }) + }, + }), + ]) + ]), h('.cell.row', { style: { background: '#f7f7f7', diff --git a/ui/app/components/pending-tx.js b/ui/app/components/pending-tx.js index f1f479794..23b0dc00f 100644 --- a/ui/app/components/pending-tx.js +++ b/ui/app/components/pending-tx.js @@ -2,7 +2,6 @@ const Component = require('react').Component const h = require('react-hyperscript') const inherits = require('util').inherits const PendingTxDetails = require('./pending-tx-details') -const HexInput = require('./hex-as-decimal-input') module.exports = PendingTx @@ -78,21 +77,6 @@ PendingTx.prototype.render = function () { onClick: props.cancelTransaction, }, 'Reject'), ]), - - h(HexInput, { - value: gas, - onChange: (newHex) => { - this.setState({ gas: newHex }) - }, - }), - - h(HexInput, { - value: gasPrice, - onChange: (newHex) => { - this.setState({ gasPrice: newHex }) - }, - }), - ]) ) } -- cgit