1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Enables Cancel button in confirmation screen.

This commit is contained in:
Dan 2017-09-13 12:41:03 -02:30 committed by Chi Kei Chan
parent e2dc9328fc
commit a5ab91e572
2 changed files with 12 additions and 2 deletions

View File

@ -48,6 +48,7 @@ function mapDispatchToProps (dispatch) {
return { return {
setCurrentCurrencyToUSD: () => dispatch(actions.setCurrentCurrency('USD')), setCurrentCurrencyToUSD: () => dispatch(actions.setCurrentCurrency('USD')),
backToAccountDetail: address => dispatch(actions.backToAccountDetail(address)), backToAccountDetail: address => dispatch(actions.backToAccountDetail(address)),
cancelTransaction: ({ id }) => dispatch(actions.cancelTx({ id }))
} }
} }
@ -306,7 +307,7 @@ PendingTx.prototype.render = function () {
]), ]),
h('form#pending-tx-form.flex-column.flex-center', { h('form#pending-tx-form.flex-column.flex-center', {
onSubmit: this.onSubmit, // onSubmit: this.onSubmit,
}, [ }, [
// Reset Button // Reset Button
// h('button', { // h('button', {
@ -320,7 +321,9 @@ PendingTx.prototype.render = function () {
h('button.confirm-screen-confirm-button', ['CONFIRM']), h('button.confirm-screen-confirm-button', ['CONFIRM']),
// Cancel Button // Cancel Button
h('button.cancel.btn-light.confirm-screen-cancel-button', {}, 'CANCEL'), h('div.cancel.btn-light.confirm-screen-cancel-button', {
onClick: (event) => this.cancel(event, txMeta),
}, 'CANCEL'),
]), ]),
]) ])
) )
@ -366,6 +369,7 @@ PendingTx.prototype.onSubmit = function (event) {
const txMeta = this.gatherTxMeta() const txMeta = this.gatherTxMeta()
const valid = this.checkValidity() const valid = this.checkValidity()
this.setState({ valid, submitting: true }) this.setState({ valid, submitting: true })
if (valid && this.verifyGasParams()) { if (valid && this.verifyGasParams()) {
this.props.sendTransaction(txMeta, event) this.props.sendTransaction(txMeta, event)
} else { } else {
@ -374,6 +378,11 @@ PendingTx.prototype.onSubmit = function (event) {
} }
} }
PendingTx.prototype.cancel = function (event, txMeta) {
event.preventDefault()
this.props.cancelTransaction(txMeta)
}
PendingTx.prototype.checkValidity = function () { PendingTx.prototype.checkValidity = function () {
const form = this.getFormEl() const form = this.getFormEl()
const valid = form.checkValidity() const valid = form.checkValidity()

View File

@ -249,6 +249,7 @@ section .confirm-screen-account-number,
padding-bottom: 15px; padding-bottom: 15px;
font-size: 16px; font-size: 16px;
box-shadow: none; box-shadow: none;
cursor: pointer;
} }
#pending-tx-form { #pending-tx-form {