1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-22 17:33:23 +01:00

Show confirm transaction screen when clicking a pending transaction in the list.

This commit is contained in:
Dan 2017-08-30 00:46:30 -02:30 committed by Chi Kei Chan
parent aa60944e30
commit 6d3b3d4203
4 changed files with 20 additions and 7 deletions

View File

@ -421,7 +421,7 @@ function signTx (txData) {
if (err) return dispatch(actions.displayWarning(err.message)) if (err) return dispatch(actions.displayWarning(err.message))
dispatch(actions.hideWarning()) dispatch(actions.hideWarning())
}) })
dispatch(actions.showConfTxPage()) dispatch(actions.showConfTxPage({}))
} }
} }
@ -626,10 +626,11 @@ function showAccountsPage () {
} }
} }
function showConfTxPage (transForward = true) { function showConfTxPage ({transForward = true, id}) {
return { return {
type: actions.SHOW_CONF_TX_PAGE, type: actions.SHOW_CONF_TX_PAGE,
transForward: transForward, transForward,
id,
} }
} }

View File

@ -245,7 +245,7 @@ BuyButtonSubview.prototype.navigateTo = function (url) {
BuyButtonSubview.prototype.backButtonContext = function () { BuyButtonSubview.prototype.backButtonContext = function () {
if (this.props.context === 'confTx') { if (this.props.context === 'confTx') {
this.props.dispatch(actions.showConfTxPage(false)) this.props.dispatch(actions.showConfTxPage({transForward: false}))
} else { } else {
this.props.dispatch(actions.goHome()) this.props.dispatch(actions.goHome())
} }

View File

@ -5,8 +5,9 @@ const inherits = require('util').inherits
const selectors = require('../selectors') const selectors = require('../selectors')
const Identicon = require('./identicon') const Identicon = require('./identicon')
const { formatBalance, formatDate } = require('../util') const { formatBalance, formatDate } = require('../util')
const { showConfTxPage } = require('../actions')
module.exports = connect(mapStateToProps)(TxList) module.exports = connect(mapStateToProps, mapDispatchToProps)(TxList)
function mapStateToProps (state) { function mapStateToProps (state) {
return { return {
@ -15,6 +16,12 @@ function mapStateToProps (state) {
} }
} }
function mapDispatchToProps (dispatch) {
return {
showConfTxPage: ({ id }) => dispatch(showConfTxPage({ id }))
}
}
inherits(TxList, Component) inherits(TxList, Component)
function TxList () { function TxList () {
Component.call(this) Component.call(this)
@ -22,7 +29,7 @@ function TxList () {
TxList.prototype.render = function () { TxList.prototype.render = function () {
// console.log('transactions to render', txsToRender) const { txsToRender, showConfTxPage } = this.props
return h('div.flex-column.tx-list-container', {}, [ return h('div.flex-column.tx-list-container', {}, [
@ -73,18 +80,23 @@ TxList.prototype.renderTransactionListItem = function (transaction) {
address: transaction.txParams.to, address: transaction.txParams.to,
transactionStatus: transaction.status, transactionStatus: transaction.status,
transactionAmount: formatBalance(transaction.txParams.value, 6), transactionAmount: formatBalance(transaction.txParams.value, 6),
transActionId: transaction.id,
} }
const { const {
address, address,
transactionStatus, transactionStatus,
transactionAmount, transactionAmount,
dateString, dateString,
transActionId,
} = props } = props
const { showConfTxPage } = this.props
return h('div.tx-list-item', { return h('div.tx-list-item', {
key: transaction.id, key: transaction.id,
}, [ }, [
h('div.flex-column.tx-list-item__wrapper', { h('div.flex-column.tx-list-item__wrapper', {
onClick: () => transactionStatus === 'unapproved' && showConfTxPage({id: transActionId}),
style: {}, style: {},
}, [ }, [

View File

@ -360,7 +360,7 @@ function reduceApp (state, action) {
return extend(appState, { return extend(appState, {
currentView: { currentView: {
name: 'confTx', name: 'confTx',
context: 0, context: action.id && indexForPending(state, action.id) || 0,
}, },
transForward: action.transForward, transForward: action.transForward,
warning: null, warning: null,