diff options
author | Dan Finlay <dan@danfinlay.com> | 2017-06-15 05:21:50 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2017-06-15 05:21:50 +0800 |
commit | b7b9e0c1ac203d39196753f39f17a1fe2f4751e5 (patch) | |
tree | 278b3055a84952afbd063b9c95d10d4320e42048 /ui/app/account-detail.js | |
parent | 3df2f2b2d4239a033ba23d14a75e0a10ece584aa (diff) | |
download | tangerine-wallet-browser-b7b9e0c1ac203d39196753f39f17a1fe2f4751e5.tar.gz tangerine-wallet-browser-b7b9e0c1ac203d39196753f39f17a1fe2f4751e5.tar.zst tangerine-wallet-browser-b7b9e0c1ac203d39196753f39f17a1fe2f4751e5.zip |
Persist selected account tab
Also improve error handling with token balances.
Diffstat (limited to 'ui/app/account-detail.js')
-rw-r--r-- | ui/app/account-detail.js | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/ui/app/account-detail.js b/ui/app/account-detail.js index 2e7f3b1be..836032b3c 100644 --- a/ui/app/account-detail.js +++ b/ui/app/account-detail.js @@ -34,12 +34,12 @@ function mapStateToProps (state) { transactions: state.metamask.selectedAddressTxList || [], conversionRate: state.metamask.conversionRate, currentCurrency: state.metamask.currentCurrency, + currentAccountTab: state.metamask.currentAccountTab, } } inherits(AccountDetailScreen, Component) function AccountDetailScreen () { - this.state = { tabSelection: 'history' } Component.call(this) } @@ -251,7 +251,8 @@ AccountDetailScreen.prototype.subview = function () { } AccountDetailScreen.prototype.tabSections = function () { - const tabSelection = this.state.tabSelection + const { currentAccountTab } = this.props + return h('section.tabSection', [ h(TabBar, { @@ -259,9 +260,9 @@ AccountDetailScreen.prototype.tabSections = function () { { content: 'Sent', key: 'history' }, { content: 'Tokens', key: 'tokens' }, ], - defaultTab: tabSelection || 'history', + defaultTab: currentAccountTab || 'history', tabSelected: (key) => { - this.setState({ tabSelection: key }) + this.props.dispatch(actions.setCurrentAccountTab(key)) }, }), @@ -272,9 +273,9 @@ AccountDetailScreen.prototype.tabSections = function () { AccountDetailScreen.prototype.tabSwitchView = function () { const props = this.props const { address, network } = props - const tabSelection = this.state.tabSelection || 'history' + const { currentAccountTab } = this.props - switch (tabSelection) { + switch (currentAccountTab) { case 'tokens': return h(TokenList, { userAddress: address, network }) default: |