mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Close sidebar on token selection.
This commit is contained in:
parent
a4838b1c57
commit
b55a40c7f1
@ -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, {
|
||||
|
@ -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, {
|
||||
|
Loading…
Reference in New Issue
Block a user