diff options
author | Alexander Tseung <alextsg@gmail.com> | 2018-06-23 14:52:45 +0800 |
---|---|---|
committer | Alexander Tseung <alextsg@gmail.com> | 2018-07-07 07:27:08 +0800 |
commit | ea9d51e427b8e607e612a01629bebf153e516ad9 (patch) | |
tree | 6363cd72b7517442c718901cc8b8ed023d134081 /ui/app/components/pages/confirm-send-ether | |
parent | b4aaf30d6fe829f18dea68a5e6cc321b9fb00d4e (diff) | |
download | tangerine-wallet-browser-ea9d51e427b8e607e612a01629bebf153e516ad9.tar tangerine-wallet-browser-ea9d51e427b8e607e612a01629bebf153e516ad9.tar.gz tangerine-wallet-browser-ea9d51e427b8e607e612a01629bebf153e516ad9.tar.bz2 tangerine-wallet-browser-ea9d51e427b8e607e612a01629bebf153e516ad9.tar.lz tangerine-wallet-browser-ea9d51e427b8e607e612a01629bebf153e516ad9.tar.xz tangerine-wallet-browser-ea9d51e427b8e607e612a01629bebf153e516ad9.tar.zst tangerine-wallet-browser-ea9d51e427b8e607e612a01629bebf153e516ad9.zip |
Refactor and redesign confirm transaction views
Diffstat (limited to 'ui/app/components/pages/confirm-send-ether')
3 files changed, 69 insertions, 0 deletions
diff --git a/ui/app/components/pages/confirm-send-ether/confirm-send-ether.component.js b/ui/app/components/pages/confirm-send-ether/confirm-send-ether.component.js new file mode 100644 index 000000000..c590bacf3 --- /dev/null +++ b/ui/app/components/pages/confirm-send-ether/confirm-send-ether.component.js @@ -0,0 +1,31 @@ +import React, { Component } from 'react' +import PropTypes from 'prop-types' +import ConfirmTransactionBase from '../confirm-transaction-base' +import { SEND_ROUTE } from '../../../routes' + +export default class ConfirmSendEther extends Component { + static contextTypes = { + t: PropTypes.func, + } + + static propTypes = { + editTransaction: PropTypes.func, + history: PropTypes.object, + } + + handleEdit ({ txData }) { + const { editTransaction, history } = this.props + editTransaction(txData) + history.push(SEND_ROUTE) + } + + render () { + return ( + <ConfirmTransactionBase + action={this.context.t('confirm')} + hideData + onEdit={confirmTransactionData => this.handleEdit(confirmTransactionData)} + /> + ) + } +} diff --git a/ui/app/components/pages/confirm-send-ether/confirm-send-ether.container.js b/ui/app/components/pages/confirm-send-ether/confirm-send-ether.container.js new file mode 100644 index 000000000..898735d1a --- /dev/null +++ b/ui/app/components/pages/confirm-send-ether/confirm-send-ether.container.js @@ -0,0 +1,37 @@ +import { connect } from 'react-redux' +import { compose } from 'recompose' +import { withRouter } from 'react-router-dom' +import { updateSend } from '../../../actions' +import { clearConfirmTransaction } from '../../../ducks/confirm-transaction.duck' +import ConfirmSendEther from './confirm-send-ether.component' + +const mapDispatchToProps = dispatch => { + return { + editTransaction: txData => { + const { id, txParams } = txData + const { + gas: gasLimit, + gasPrice, + to, + value: amount, + } = txParams + + dispatch(updateSend({ + gasLimit, + gasPrice, + gasTotal: null, + to, + amount, + errors: { to: null, amount: null }, + editingTransactionId: id && id.toString(), + })) + + dispatch(clearConfirmTransaction()) + }, + } +} + +export default compose( + withRouter, + connect(null, mapDispatchToProps) +)(ConfirmSendEther) diff --git a/ui/app/components/pages/confirm-send-ether/index.js b/ui/app/components/pages/confirm-send-ether/index.js new file mode 100644 index 000000000..2d5767c39 --- /dev/null +++ b/ui/app/components/pages/confirm-send-ether/index.js @@ -0,0 +1 @@ +export { default } from './confirm-send-ether.container' |