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 {
setCurrentCurrencyToUSD: () => dispatch(actions.setCurrentCurrency('USD')),
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', {
onSubmit: this.onSubmit,
// onSubmit: this.onSubmit,
}, [
// Reset Button
// h('button', {
@ -320,7 +321,9 @@ PendingTx.prototype.render = function () {
h('button.confirm-screen-confirm-button', ['CONFIRM']),
// 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 valid = this.checkValidity()
this.setState({ valid, submitting: true })
if (valid && this.verifyGasParams()) {
this.props.sendTransaction(txMeta, event)
} 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 () {
const form = this.getFormEl()
const valid = form.checkValidity()

View File

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