diff options
author | Dan Finlay <dan@danfinlay.com> | 2016-04-26 03:20:33 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2016-04-26 03:38:43 +0800 |
commit | 2dd7bd6bd0d026da339c1e55d52270674be13f3d (patch) | |
tree | bb4b6df2be4720905db8960c3c6e4e40694eb7b9 /ui/app/reducers | |
parent | 652c1d96c1a80864218fa4dadf7aa0f4102a583b (diff) | |
download | tangerine-wallet-browser-2dd7bd6bd0d026da339c1e55d52270674be13f3d.tar tangerine-wallet-browser-2dd7bd6bd0d026da339c1e55d52270674be13f3d.tar.gz tangerine-wallet-browser-2dd7bd6bd0d026da339c1e55d52270674be13f3d.tar.bz2 tangerine-wallet-browser-2dd7bd6bd0d026da339c1e55d52270674be13f3d.tar.lz tangerine-wallet-browser-2dd7bd6bd0d026da339c1e55d52270674be13f3d.tar.xz tangerine-wallet-browser-2dd7bd6bd0d026da339c1e55d52270674be13f3d.tar.zst tangerine-wallet-browser-2dd7bd6bd0d026da339c1e55d52270674be13f3d.zip |
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.
Diffstat (limited to 'ui/app/reducers')
-rw-r--r-- | ui/app/reducers/app.js | 27 |
1 files changed, 25 insertions, 2 deletions
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', |