diff options
author | Chi Kei Chan <chikeichan@gmail.com> | 2017-10-19 13:58:46 +0800 |
---|---|---|
committer | Chi Kei Chan <chikeichan@gmail.com> | 2017-10-19 13:58:46 +0800 |
commit | c8c773d6416f92c520a509a9811d73f68aa00fc0 (patch) | |
tree | 495a798eeb4a5272c80d93725f5146a6fbcf85c8 /ui/app/conf-tx.js | |
parent | 5bdee96e73f65a0b369277e9c56b0afe5159e65b (diff) | |
parent | de1da7d1b215ade650fc644adf63384a401dc240 (diff) | |
download | tangerine-wallet-browser-c8c773d6416f92c520a509a9811d73f68aa00fc0.tar tangerine-wallet-browser-c8c773d6416f92c520a509a9811d73f68aa00fc0.tar.gz tangerine-wallet-browser-c8c773d6416f92c520a509a9811d73f68aa00fc0.tar.bz2 tangerine-wallet-browser-c8c773d6416f92c520a509a9811d73f68aa00fc0.tar.lz tangerine-wallet-browser-c8c773d6416f92c520a509a9811d73f68aa00fc0.tar.xz tangerine-wallet-browser-c8c773d6416f92c520a509a9811d73f68aa00fc0.tar.zst tangerine-wallet-browser-c8c773d6416f92c520a509a9811d73f68aa00fc0.zip |
Merge branch 'NewUI-flat' into merge
Diffstat (limited to 'ui/app/conf-tx.js')
-rw-r--r-- | ui/app/conf-tx.js | 152 |
1 files changed, 69 insertions, 83 deletions
diff --git a/ui/app/conf-tx.js b/ui/app/conf-tx.js index cb1afedfe..f201010fc 100644 --- a/ui/app/conf-tx.js +++ b/ui/app/conf-tx.js @@ -3,9 +3,7 @@ const Component = require('react').Component const h = require('react-hyperscript') const connect = require('react-redux').connect const actions = require('./actions') -const NetworkIndicator = require('./components/network') const txHelper = require('../lib/tx-helper') -const isPopupOrNotification = require('../../app/scripts/lib/is-popup-or-notification') const PendingTx = require('./components/pending-tx') const PendingMsg = require('./components/pending-msg') @@ -13,6 +11,15 @@ const PendingPersonalMsg = require('./components/pending-personal-msg') const PendingTypedMsg = require('./components/pending-typed-msg') const Loading = require('./components/loading') +// const contentDivider = h('div', { +// style: { +// marginLeft: '16px', +// marginRight: '16px', +// height:'1px', +// background:'#E7E7E7', +// }, +// }) + module.exports = connect(mapStateToProps)(ConfirmTxScreen) function mapStateToProps (state) { @@ -42,85 +49,63 @@ function ConfirmTxScreen () { ConfirmTxScreen.prototype.render = function () { const props = this.props - const { network, provider, unapprovedTxs, currentCurrency, computedBalances, - unapprovedMsgs, unapprovedPersonalMsgs, unapprovedTypedMessages, conversionRate, blockGasLimit } = props + const { + network, + unapprovedTxs, + currentCurrency, + unapprovedMsgs, + unapprovedPersonalMsgs, + unapprovedTypedMessages, + conversionRate, + blockGasLimit, + // provider, + // computedBalances, + } = props var unconfTxList = txHelper(unapprovedTxs, unapprovedMsgs, unapprovedPersonalMsgs, unapprovedTypedMessages, network) var txData = unconfTxList[props.index] || {} var txParams = txData.params || {} - var isNotification = isPopupOrNotification() === 'notification' + + // var isNotification = isPopupOrNotification() === 'notification' + /* + Client is using the flag above to render the following in conf screen + // subtitle and nav + h('.section-title.flex-row.flex-center', [ + !isNotification ? h('i.fa.fa-arrow-left.fa-lg.cursor-pointer', { + onClick: this.goHome.bind(this), + }) : null, + h('h2.page-subtitle', 'Confirm Transaction'), + isNotification ? h(NetworkIndicator, { + network: network, + provider: provider, + }) : null, + ]), + */ log.info(`rendering a combined ${unconfTxList.length} unconf msg & txs`) if (unconfTxList.length === 0) return h(Loading, { isLoading: true }) - const unconfTxListLength = unconfTxList.length - - return ( - - h('.flex-column.flex-grow', [ - - // subtitle and nav - h('.section-title.flex-row.flex-center', [ - !isNotification ? h('i.fa.fa-arrow-left.fa-lg.cursor-pointer', { - onClick: this.goHome.bind(this), - }) : null, - h('h2.page-subtitle', 'Confirm Transaction'), - isNotification ? h(NetworkIndicator, { - network: network, - provider: provider, - }) : null, - ]), - - h('h3', { - style: { - alignSelf: 'center', - display: unconfTxList.length > 1 ? 'block' : 'none', - }, - }, [ - h('i.fa.fa-arrow-left.fa-lg.cursor-pointer', { - style: { - display: props.index === 0 ? 'none' : 'inline-block', - }, - onClick: () => props.dispatch(actions.previousTx()), - }), - ` ${props.index + 1} of ${unconfTxList.length} `, - h('i.fa.fa-arrow-right.fa-lg.cursor-pointer', { - style: { - display: props.index + 1 === unconfTxList.length ? 'none' : 'inline-block', - }, - onClick: () => props.dispatch(actions.nextTx()), - }), - ]), - - warningIfExists(props.warning), - - currentTxView({ - // Properties - txData: txData, - key: txData.id, - selectedAddress: props.selectedAddress, - accounts: props.accounts, - identities: props.identities, - conversionRate, - currentCurrency, - blockGasLimit, - unconfTxListLength, - computedBalances, - // Actions - buyEth: this.buyEth.bind(this, txParams.from || props.selectedAddress), - sendTransaction: this.sendTransaction.bind(this), - cancelTransaction: this.cancelTransaction.bind(this, txData), - cancelAllTransactions: this.cancelAllTransactions.bind(this, unconfTxList), - signMessage: this.signMessage.bind(this, txData), - signPersonalMessage: this.signPersonalMessage.bind(this, txData), - signTypedMessage: this.signTypedMessage.bind(this, txData), - cancelMessage: this.cancelMessage.bind(this, txData), - cancelPersonalMessage: this.cancelPersonalMessage.bind(this, txData), - cancelTypedMessage: this.cancelTypedMessage.bind(this, txData), - }), - ]) - ) + return currentTxView({ + // Properties + txData: txData, + key: txData.id, + selectedAddress: props.selectedAddress, + accounts: props.accounts, + identities: props.identities, + conversionRate, + currentCurrency, + blockGasLimit, + // Actions + buyEth: this.buyEth.bind(this, txParams.from || props.selectedAddress), + sendTransaction: this.sendTransaction.bind(this), + cancelTransaction: this.cancelTransaction.bind(this, txData), + signMessage: this.signMessage.bind(this, txData), + signPersonalMessage: this.signPersonalMessage.bind(this, txData), + cancelMessage: this.cancelMessage.bind(this, txData), + cancelPersonalMessage: this.cancelPersonalMessage.bind(this, txData), + }) + } function currentTxView (opts) { @@ -145,6 +130,7 @@ function currentTxView (opts) { return h(PendingTypedMsg, opts) } } + return h(Loading, { isLoading: true }) } ConfirmTxScreen.prototype.buyEth = function (address, event) { @@ -222,14 +208,14 @@ ConfirmTxScreen.prototype.goHome = function (event) { this.props.dispatch(actions.goHome()) } -function warningIfExists (warning) { - if (warning && - // Do not display user rejections on this screen: - warning.indexOf('User denied transaction signature') === -1) { - return h('.error', { - style: { - margin: 'auto', - }, - }, warning) - } -} +// function warningIfExists (warning) { +// if (warning && +// // Do not display user rejections on this screen: +// warning.indexOf('User denied transaction signature') === -1) { +// return h('.error', { +// style: { +// margin: 'auto', +// }, +// }, warning) +// } +// } |