diff options
author | Dan Finlay <dan@danfinlay.com> | 2016-05-26 07:28:07 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2016-05-26 07:28:07 +0800 |
commit | 294b16a275d35983eb9f0e720a84ef95e0fad186 (patch) | |
tree | fbe37acb0e7fbdadcbdb4ee3eff763b7e49cf110 | |
parent | 4f9e66994d7287344fcab4c8e23d7eec971603b1 (diff) | |
download | tangerine-wallet-browser-294b16a275d35983eb9f0e720a84ef95e0fad186.tar tangerine-wallet-browser-294b16a275d35983eb9f0e720a84ef95e0fad186.tar.gz tangerine-wallet-browser-294b16a275d35983eb9f0e720a84ef95e0fad186.tar.bz2 tangerine-wallet-browser-294b16a275d35983eb9f0e720a84ef95e0fad186.tar.lz tangerine-wallet-browser-294b16a275d35983eb9f0e720a84ef95e0fad186.tar.xz tangerine-wallet-browser-294b16a275d35983eb9f0e720a84ef95e0fad186.tar.zst tangerine-wallet-browser-294b16a275d35983eb9f0e720a84ef95e0fad186.zip |
Fix back button on pending tx screen
Fixes #208
-rw-r--r-- | ui/app/app.js | 14 | ||||
-rw-r--r-- | ui/app/reducers/app.js | 23 |
2 files changed, 21 insertions, 16 deletions
diff --git a/ui/app/app.js b/ui/app/app.js index 73791ec13..7e7ca24ad 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -239,11 +239,7 @@ App.prototype.renderPrimary = function(){ return h(CreateVaultScreen, {key: 'createVault'}) default: - if (this.hasPendingTxs()) { - return h(ConfirmTxScreen, {key: 'confirm-tx'}) - } else { - return h(AccountDetailScreen, {key: 'account-detail'}) - } + return h(AccountDetailScreen, {key: 'account-detail'}) } } @@ -259,14 +255,6 @@ App.prototype.toggleMetamaskActive = function(){ } } -App.prototype.hasPendingTxs = function() { - var state = this.props - var unconfTxs = state.unconfTxs - var unconfMsgs = state.unconfMsgs - var unconfTxList = txHelper(unconfTxs, unconfMsgs) - return unconfTxList.length > 0 -} - function onOffToggle(state){ var buttonSize = '50px'; var lockWidth = '20px'; 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 +} |