From 294b16a275d35983eb9f0e720a84ef95e0fad186 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Wed, 25 May 2016 16:28:07 -0700 Subject: Fix back button on pending tx screen Fixes #208 --- ui/app/reducers/app.js | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'ui/app/reducers/app.js') diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js index a29a8f79c..92b44612d 100644 --- a/ui/app/reducers/app.js +++ b/ui/app/reducers/app.js @@ -9,8 +9,17 @@ function reduceApp(state, action) { // clone and defaults const selectedAccount = state.metamask.selectedAccount + const pendingTxs = hasPendingTxs(state) + let name = 'accounts' + if (selectedAccount) { + defaultView = 'accountDetail' + } + if (pendingTxs) { + defaultView = 'confTx' + } + var defaultView = { - name: selectedAccount ? 'accountDetail' : 'accounts', + name, detailView: null, context: selectedAccount, } @@ -122,7 +131,6 @@ function reduceApp(state, action) { case actions.UNLOCK_METAMASK: return extend(appState, { - currentView: {}, detailView: {}, transForward: true, isLoading: false, @@ -145,7 +153,9 @@ function reduceApp(state, action) { case actions.GO_HOME: return extend(appState, { - currentView: {}, + currentView: extend(appState.currentView, { + name: 'accountDetail', + }), accountDetail: { subview: 'transactions', accountExport: 'none', @@ -349,3 +359,10 @@ function reduceApp(state, action) { } } + +function hasPendingTxs (state) { + var unconfTxs = state.metamask.unconfTxs + var unconfMsgs = state.metamask.unconfMsgs + var unconfTxList = txHelper(unconfTxs, unconfMsgs) + return unconfTxList.length > 0 +} -- cgit v1.2.3 From 5669f44300fc0493ce2c1221f0c5531eb3850882 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Wed, 25 May 2016 16:54:43 -0700 Subject: Add number indicating pending txs to account list --- ui/app/reducers/app.js | 1 - 1 file changed, 1 deletion(-) (limited to 'ui/app/reducers/app.js') diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js index 92b44612d..ae7501725 100644 --- a/ui/app/reducers/app.js +++ b/ui/app/reducers/app.js @@ -356,7 +356,6 @@ function reduceApp(state, action) { default: return appState - } } -- cgit v1.2.3