From ea9d51e427b8e607e612a01629bebf153e516ad9 Mon Sep 17 00:00:00 2001 From: Alexander Tseung Date: Fri, 22 Jun 2018 23:52:45 -0700 Subject: Refactor and redesign confirm transaction views --- .../confirm-send-ether.component.js | 31 ++++++++++++++++++ .../confirm-send-ether.container.js | 37 ++++++++++++++++++++++ .../components/pages/confirm-send-ether/index.js | 1 + 3 files changed, 69 insertions(+) create mode 100644 ui/app/components/pages/confirm-send-ether/confirm-send-ether.component.js create mode 100644 ui/app/components/pages/confirm-send-ether/confirm-send-ether.container.js create mode 100644 ui/app/components/pages/confirm-send-ether/index.js (limited to 'ui/app/components/pages/confirm-send-ether') 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 ( + 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' -- cgit v1.2.3 From 67017711df521e4d9f92cfc756b5468f7704a79c Mon Sep 17 00:00:00 2001 From: Alexander Tseung Date: Wed, 11 Jul 2018 17:34:41 -0700 Subject: Fix font sizes, colors. Include data tab for send-eth transaction confirmations that have data --- .../pages/confirm-send-ether/confirm-send-ether.component.js | 10 +++++++++- .../pages/confirm-send-ether/confirm-send-ether.container.js | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) (limited to 'ui/app/components/pages/confirm-send-ether') 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 index c590bacf3..442a478b8 100644 --- 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 @@ -11,6 +11,7 @@ export default class ConfirmSendEther extends Component { static propTypes = { editTransaction: PropTypes.func, history: PropTypes.object, + txParams: PropTypes.object, } handleEdit ({ txData }) { @@ -19,11 +20,18 @@ export default class ConfirmSendEther extends Component { history.push(SEND_ROUTE) } + shouldHideData () { + const { txParams = {} } = this.props + return !txParams.data + } + render () { + const hideData = this.shouldHideData() + return ( 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 index 898735d1a..e48ef54a8 100644 --- 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 @@ -5,6 +5,14 @@ import { updateSend } from '../../../actions' import { clearConfirmTransaction } from '../../../ducks/confirm-transaction.duck' import ConfirmSendEther from './confirm-send-ether.component' +const mapStateToProps = state => { + const { confirmTransaction: { txData: { txParams } = {} } } = state + + return { + txParams, + } +} + const mapDispatchToProps = dispatch => { return { editTransaction: txData => { @@ -33,5 +41,5 @@ const mapDispatchToProps = dispatch => { export default compose( withRouter, - connect(null, mapDispatchToProps) + connect(mapStateToProps, mapDispatchToProps) )(ConfirmSendEther) -- cgit v1.2.3