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

Fix back button on pending tx screen

Fixes #208
This commit is contained in:
Dan Finlay 2016-05-25 16:28:07 -07:00
parent 4f9e66994d
commit 294b16a275
2 changed files with 21 additions and 16 deletions

View File

@ -239,11 +239,7 @@ App.prototype.renderPrimary = function(){
return h(CreateVaultScreen, {key: 'createVault'}) return h(CreateVaultScreen, {key: 'createVault'})
default: default:
if (this.hasPendingTxs()) { return h(AccountDetailScreen, {key: 'account-detail'})
return h(ConfirmTxScreen, {key: 'confirm-tx'})
} else {
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){ function onOffToggle(state){
var buttonSize = '50px'; var buttonSize = '50px';
var lockWidth = '20px'; var lockWidth = '20px';

View File

@ -9,8 +9,17 @@ function reduceApp(state, action) {
// clone and defaults // clone and defaults
const selectedAccount = state.metamask.selectedAccount const selectedAccount = state.metamask.selectedAccount
const pendingTxs = hasPendingTxs(state)
let name = 'accounts'
if (selectedAccount) {
defaultView = 'accountDetail'
}
if (pendingTxs) {
defaultView = 'confTx'
}
var defaultView = { var defaultView = {
name: selectedAccount ? 'accountDetail' : 'accounts', name,
detailView: null, detailView: null,
context: selectedAccount, context: selectedAccount,
} }
@ -122,7 +131,6 @@ function reduceApp(state, action) {
case actions.UNLOCK_METAMASK: case actions.UNLOCK_METAMASK:
return extend(appState, { return extend(appState, {
currentView: {},
detailView: {}, detailView: {},
transForward: true, transForward: true,
isLoading: false, isLoading: false,
@ -145,7 +153,9 @@ function reduceApp(state, action) {
case actions.GO_HOME: case actions.GO_HOME:
return extend(appState, { return extend(appState, {
currentView: {}, currentView: extend(appState.currentView, {
name: 'accountDetail',
}),
accountDetail: { accountDetail: {
subview: 'transactions', subview: 'transactions',
accountExport: 'none', 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
}