From 5da6fd5ab18812929cbf790527a3029fd8d7123c Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Thu, 26 May 2016 14:32:45 -0700 Subject: Add clicking txs in list shows tx conf screen --- ui/app/reducers/app.js | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'ui/app/reducers/app.js') diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js index a98b809d6..08c2268c1 100644 --- a/ui/app/reducers/app.js +++ b/ui/app/reducers/app.js @@ -12,10 +12,10 @@ function reduceApp(state, action) { const pendingTxs = hasPendingTxs(state) let name = 'accounts' if (selectedAccount) { - defaultView = 'accountDetail' + name = 'accountDetail' } if (pendingTxs) { - defaultView = 'confTx' + name = 'confTx' } var defaultView = { @@ -270,6 +270,17 @@ function reduceApp(state, action) { } }) + case actions.VIEW_PENDING_TX: + const context = indexForPending(state, action.value) + return extend(appState, { + transForward: true, + currentView: { + name: 'confTx', + context, + warning: null, + } + }) + case actions.PREVIOUS_TX: return extend(appState, { transForward: false, @@ -366,3 +377,16 @@ function hasPendingTxs (state) { var unconfTxList = txHelper(unconfTxs, unconfMsgs) return unconfTxList.length > 0 } + +function indexForPending(state, txId) { + var unconfTxs = state.metamask.unconfTxs + var unconfMsgs = state.metamask.unconfMsgs + var unconfTxList = txHelper(unconfTxs, unconfMsgs) + let idx + unconfTxList.forEach((tx, i) => { + if (tx.id === txId) { + idx = i + } + }) + return idx +} -- cgit