diff options
author | Dan <danjm.com@gmail.com> | 2017-09-28 19:55:04 +0800 |
---|---|---|
committer | Chi Kei Chan <chikeichan@gmail.com> | 2017-09-29 06:54:04 +0800 |
commit | b55a40c7f144645a29569294996893cb1b519779 (patch) | |
tree | 1d47f3b0ba14d070ceba6c4ed3a5c34b892f9a33 /ui | |
parent | a4838b1c575f08f9a83457222737075bab374936 (diff) | |
download | tangerine-wallet-browser-b55a40c7f144645a29569294996893cb1b519779.tar tangerine-wallet-browser-b55a40c7f144645a29569294996893cb1b519779.tar.gz tangerine-wallet-browser-b55a40c7f144645a29569294996893cb1b519779.tar.bz2 tangerine-wallet-browser-b55a40c7f144645a29569294996893cb1b519779.tar.lz tangerine-wallet-browser-b55a40c7f144645a29569294996893cb1b519779.tar.xz tangerine-wallet-browser-b55a40c7f144645a29569294996893cb1b519779.tar.zst tangerine-wallet-browser-b55a40c7f144645a29569294996893cb1b519779.zip |
Close sidebar on token selection.
Diffstat (limited to 'ui')
-rw-r--r-- | ui/app/components/token-cell.js | 11 | ||||
-rw-r--r-- | ui/app/components/wallet-view.js | 13 |
2 files changed, 20 insertions, 4 deletions
diff --git a/ui/app/components/token-cell.js b/ui/app/components/token-cell.js index dc1c7f46f..e87d2c859 100644 --- a/ui/app/components/token-cell.js +++ b/ui/app/components/token-cell.js @@ -15,6 +15,7 @@ function mapStateToProps (state) { userAddress: selectors.getSelectedAddress(state), tokenExchangeRates: state.metamask.tokenExchangeRates, ethToUSDRate: state.metamask.conversionRate, + sidebarOpen: state.appState.sidebarOpen, } } @@ -22,6 +23,7 @@ function mapDispatchToProps (dispatch) { return { setSelectedToken: address => dispatch(actions.setSelectedToken(address)), updateTokenExchangeRate: token => dispatch(actions.updateTokenExchangeRate(token)), + hideSidebar: () => dispatch(actions.hideSidebar()), } } @@ -52,6 +54,8 @@ TokenCell.prototype.render = function () { selectedTokenAddress, tokenExchangeRates, ethToUSDRate, + hideSidebar, + sidebarOpen, // userAddress, } = props @@ -73,13 +77,16 @@ TokenCell.prototype.render = function () { }) formattedUSD = `$${currentTokenInUSD} USD`; } - + return ( h('div.token-list-item', { className: `token-list-item ${selectedTokenAddress === address ? 'token-list-item--active' : ''}`, // style: { cursor: network === '1' ? 'pointer' : 'default' }, // onClick: this.view.bind(this, address, userAddress, network), - onClick: () => setSelectedToken(address), + onClick: () => { + setSelectedToken(address) + selectedTokenAddress !== address && sidebarOpen && hideSidebar() + }, }, [ h(Identicon, { diff --git a/ui/app/components/wallet-view.js b/ui/app/components/wallet-view.js index b306fb7d4..00c86298d 100644 --- a/ui/app/components/wallet-view.js +++ b/ui/app/components/wallet-view.js @@ -40,7 +40,13 @@ function WalletView () { } WalletView.prototype.renderWalletBalance = function () { - const { selectedTokenAddress, selectedAccount, unsetSelectedToken } = this.props + const { + selectedTokenAddress, + selectedAccount, + unsetSelectedToken, + hideSidebar, + sidebarOpen + } = this.props const selectedClass = selectedTokenAddress ? '' : 'wallet-balance-wrapper--active' @@ -49,7 +55,10 @@ WalletView.prototype.renderWalletBalance = function () { return h('div', { className }, [ h('div.wallet-balance', { - onClick: unsetSelectedToken, + onClick: () => { + unsetSelectedToken() + selectedTokenAddress && sidebarOpen && hideSidebar() + }, }, [ h(BalanceComponent, { |