aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/account-menu
diff options
context:
space:
mode:
authorAlexander Tseung <alextsg@gmail.com>2017-11-29 12:24:35 +0800
committerAlexander Tseung <alextsg@gmail.com>2017-12-15 04:50:20 +0800
commite226b10a89d87af07c7c35ff1251a8264f3bb1b8 (patch)
tree2a1507463ac1074a39e4ebd3ae609be0a2962bc6 /ui/app/components/account-menu
parent339eb7d1a687f141e822c745c568063783d44f15 (diff)
downloadtangerine-wallet-browser-e226b10a89d87af07c7c35ff1251a8264f3bb1b8.tar.gz
tangerine-wallet-browser-e226b10a89d87af07c7c35ff1251a8264f3bb1b8.tar.zst
tangerine-wallet-browser-e226b10a89d87af07c7c35ff1251a8264f3bb1b8.zip
Add react-router to allow use of the browser back button
Diffstat (limited to 'ui/app/components/account-menu')
-rw-r--r--ui/app/components/account-menu/index.js25
1 files changed, 20 insertions, 5 deletions
diff --git a/ui/app/components/account-menu/index.js b/ui/app/components/account-menu/index.js
index a9f075ec7..0965cba38 100644
--- a/ui/app/components/account-menu/index.js
+++ b/ui/app/components/account-menu/index.js
@@ -1,13 +1,19 @@
const inherits = require('util').inherits
const Component = require('react').Component
const connect = require('react-redux').connect
+const { compose } = require('recompose')
+const { withRouter } = require('react-router-dom')
const h = require('react-hyperscript')
const actions = require('../../actions')
const { Menu, Item, Divider, CloseArea } = require('../dropdowns/components/menu')
const Identicon = require('../identicon')
const { formatBalance } = require('../../util')
+const { SETTINGS_ROUTE, INFO_ROUTE, IMPORT_ACCOUNT_ROUTE } = require('../../routes')
-module.exports = connect(mapStateToProps, mapDispatchToProps)(AccountMenu)
+module.exports = compose(
+ withRouter,
+ connect(mapStateToProps, mapDispatchToProps)
+)(AccountMenu)
inherits(AccountMenu, Component)
function AccountMenu () { Component.call(this) }
@@ -19,7 +25,6 @@ function mapStateToProps (state) {
keyrings: state.metamask.keyrings,
identities: state.metamask.identities,
accounts: state.metamask.accounts,
-
}
}
@@ -63,6 +68,7 @@ AccountMenu.prototype.render = function () {
lockMetamask,
showConfigPage,
showInfoPage,
+ history,
} = this.props
return h(Menu, { className: 'account-menu', isShowing: isAccountMenuOpen }, [
@@ -84,18 +90,27 @@ AccountMenu.prototype.render = function () {
text: 'Create Account',
}),
h(Item, {
- onClick: showImportPage,
+ onClick: () => {
+ toggleAccountMenu()
+ history.push(IMPORT_ACCOUNT_ROUTE)
+ },
icon: h('img', { src: 'images/import-account.svg' }),
text: 'Import Account',
}),
h(Divider),
h(Item, {
- onClick: showInfoPage,
+ onClick: () => {
+ toggleAccountMenu()
+ history.push(INFO_ROUTE)
+ },
icon: h('img', { src: 'images/mm-info-icon.svg' }),
text: 'Info & Help',
}),
h(Item, {
- onClick: showConfigPage,
+ onClick: () => {
+ toggleAccountMenu()
+ history.push(SETTINGS_ROUTE)
+ },
icon: h('img', { src: 'images/settings.svg' }),
text: 'Settings',
}),