From 2dd7bd6bd0d026da339c1e55d52270674be13f3d Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Mon, 25 Apr 2016 12:20:33 -0700 Subject: Make account detail view the primary view - When unlocking, the first account is now selected by default and displayed as the main view. - There is now a "CHANGE ACCT" button on the detail view to show the accounts list. - Clicking an account from the accounts list now navigates to the detail view and selects that account. - Config/Info screen "back" buttons now fire a new action, `GO_HOME`, which is configured to navigate to the accountDetail view, putting that logic in one place. - When locking and unlocking again, the first account is always displayed, eventually we should persist the selection. --- ui/app/reducers/app.js | 27 +++++++++++++++++++++++++-- 1 file changed, 25 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 582583185..d3d5ad638 100644 --- a/ui/app/reducers/app.js +++ b/ui/app/reducers/app.js @@ -1,14 +1,18 @@ const extend = require('xtend') const actions = require('../actions') +const valuesFor = require('../util').valuesFor module.exports = reduceApp function reduceApp(state, action) { // clone and defaults + var accounts = valuesFor(state.metamask.accounts) + var account = accounts.length ? valuesFor(state.metamask.accounts)[0].address : null var defaultView = { - name: 'accounts', + name: 'accountDetail', detailView: null, + context: account, } // confirm seed words @@ -56,6 +60,7 @@ function reduceApp(state, action) { return extend(appState, { currentView: { name: 'config', + context: appState.currentView.context, }, transForward: true, }) @@ -64,6 +69,7 @@ function reduceApp(state, action) { return extend(appState, { currentView: { name: 'info', + context: appState.currentView.context, }, transForward: true, }) @@ -120,11 +126,28 @@ function reduceApp(state, action) { activeAddress: action.value, }) + case actions.GO_HOME: + return extend(appState, { + currentView: { + name: 'accountDetail', + context: appState.currentView.context, + }, + accountDetail: { + accountExport: 'none', + privateKey: '', + }, + transForward: false, + }) + + case actions.SHOW_ACCOUNT_DETAIL: + var account = action.value || valuesFor(state.metamask.accounts)[0].address + return extend(appState, { + isLoading: account ? false : true, currentView: { name: 'accountDetail', - context: action.value, + context: account, }, accountDetail: { accountExport: 'none', -- cgit From 44c68eb23c8fe510438fa44c26a5acd99bbe19e8 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Mon, 25 Apr 2016 13:41:06 -0700 Subject: Fix test --- ui/app/reducers/app.js | 2 -- 1 file changed, 2 deletions(-) (limited to 'ui/app/reducers/app.js') diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js index d3d5ad638..46bc3c36d 100644 --- a/ui/app/reducers/app.js +++ b/ui/app/reducers/app.js @@ -141,8 +141,6 @@ function reduceApp(state, action) { case actions.SHOW_ACCOUNT_DETAIL: - var account = action.value || valuesFor(state.metamask.accounts)[0].address - return extend(appState, { isLoading: account ? false : true, currentView: { -- cgit From 4c46cbc99cbed0de560b3c2ba8fe502c1c5343a8 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Mon, 25 Apr 2016 13:49:46 -0700 Subject: Fixed some loading bugs --- ui/app/reducers/app.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'ui/app/reducers/app.js') diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js index 46bc3c36d..131b434e9 100644 --- a/ui/app/reducers/app.js +++ b/ui/app/reducers/app.js @@ -139,13 +139,11 @@ function reduceApp(state, action) { transForward: false, }) - case actions.SHOW_ACCOUNT_DETAIL: return extend(appState, { - isLoading: account ? false : true, currentView: { name: 'accountDetail', - context: account, + context: action.value || account, }, accountDetail: { accountExport: 'none', -- cgit From 1025eb3b4f90c2b909fe9d238cebba878c8ce2db Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Mon, 25 Apr 2016 14:14:34 -0700 Subject: Persist selected account When selecting an account, we now persist the selection to the `configManager`, so the selection can be restored when re-unlocking Metamask. Also found the bug where `rawtestrpc` was still being used as a default, and fixed it! --- ui/app/reducers/app.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'ui/app/reducers/app.js') diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js index 131b434e9..f522e6042 100644 --- a/ui/app/reducers/app.js +++ b/ui/app/reducers/app.js @@ -7,12 +7,10 @@ module.exports = reduceApp function reduceApp(state, action) { // clone and defaults - var accounts = valuesFor(state.metamask.accounts) - var account = accounts.length ? valuesFor(state.metamask.accounts)[0].address : null var defaultView = { name: 'accountDetail', detailView: null, - context: account, + context: state.metamask.selectedAccount, } // confirm seed words -- cgit