aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2016-07-02 01:25:19 +0800
committerDan Finlay <dan@danfinlay.com>2016-07-02 01:25:19 +0800
commit51a5e66cbbbf35baa62e74e3545cf478cc05241e (patch)
tree9087b2de9fd6653f4059bf8140b1ae117ed012c6 /ui
parent6ec387b6751273ad09aed876a03f7ee95dc86c1a (diff)
downloadtangerine-wallet-browser-51a5e66cbbbf35baa62e74e3545cf478cc05241e.tar
tangerine-wallet-browser-51a5e66cbbbf35baa62e74e3545cf478cc05241e.tar.gz
tangerine-wallet-browser-51a5e66cbbbf35baa62e74e3545cf478cc05241e.tar.bz2
tangerine-wallet-browser-51a5e66cbbbf35baa62e74e3545cf478cc05241e.tar.lz
tangerine-wallet-browser-51a5e66cbbbf35baa62e74e3545cf478cc05241e.tar.xz
tangerine-wallet-browser-51a5e66cbbbf35baa62e74e3545cf478cc05241e.tar.zst
tangerine-wallet-browser-51a5e66cbbbf35baa62e74e3545cf478cc05241e.zip
Move main drop-down state to component state
Diffstat (limited to 'ui')
-rw-r--r--ui/app/actions.js19
-rw-r--r--ui/app/app.js15
-rw-r--r--ui/app/reducers/app.js10
3 files changed, 9 insertions, 35 deletions
diff --git a/ui/app/actions.js b/ui/app/actions.js
index c6b57d29d..3e0fe55c0 100644
--- a/ui/app/actions.js
+++ b/ui/app/actions.js
@@ -2,10 +2,6 @@ var actions = {
GO_HOME: 'GO_HOME',
goHome: goHome,
// menu state
- TOGGLE_MENU: 'TOGGLE_MENU',
- toggleMenu: toggleMenu,
- SET_MENU_STATE: 'SET_MENU_STATE',
- closeMenu: closeMenu,
getNetworkStatus: 'getNetworkStatus',
// remote state
@@ -125,21 +121,6 @@ function goHome () {
}
}
-// menu state
-
-function toggleMenu () {
- return {
- type: actions.TOGGLE_MENU,
- }
-}
-
-function closeMenu () {
- return {
- type: actions.SET_MENU_STATE,
- value: false,
- }
-}
-
// async actions
function tryUnlockMetamask (password) {
diff --git a/ui/app/app.js b/ui/app/app.js
index f58f695af..4652d36ff 100644
--- a/ui/app/app.js
+++ b/ui/app/app.js
@@ -178,7 +178,7 @@ App.prototype.renderAppBar = function () {
onClick: (event) => {
event.preventDefault()
event.stopPropagation()
- this.props.dispatch(actions.toggleMenu())
+ this.setState({ isMainMenuOpen: true })
},
}),
]),
@@ -241,10 +241,13 @@ App.prototype.renderNetworkDropdown = function () {
App.prototype.renderDropdown = function () {
const props = this.props
+ const state = this.state || {}
+ const isOpen = state.isMainMenuOpen
+
return h(MenuDroppo, {
- isOpen: props.menuOpen,
+ isOpen: isOpen,
onClickOutside: (event) => {
- this.props.dispatch(actions.closeMenu())
+ this.setState({ isMainMenuOpen: !isOpen })
},
style: {
position: 'absolute',
@@ -263,21 +266,21 @@ App.prototype.renderDropdown = function () {
h(DropMenuItem, {
label: 'Settings',
- closeMenu: () => this.props.dispatch(actions.closeMenu()),
+ closeMenu: () => this.setState({ isMainMenuOpen: !isOpen }),
action: () => this.props.dispatch(actions.showConfigPage()),
icon: h('i.fa.fa-gear.fa-lg', { ariaHidden: true }),
}),
h(DropMenuItem, {
label: 'Lock',
- closeMenu: () => this.props.dispatch(actions.closeMenu()),
+ closeMenu: () => this.setState({ isMainMenuOpen: !isOpen }),
action: () => this.props.dispatch(actions.lockMetamask()),
icon: h('i.fa.fa-lock.fa-lg', { ariaHidden: true }),
}),
h(DropMenuItem, {
label: 'Help',
- closeMenu: () => this.props.dispatch(actions.closeMenu()),
+ closeMenu: () => this.setState({ isMainMenuOpen: !isOpen }),
action: () => this.props.dispatch(actions.showInfoPage()),
icon: h('i.fa.fa-question.fa-lg', { ariaHidden: true }),
}),
diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js
index f45be0433..06afd0ae1 100644
--- a/ui/app/reducers/app.js
+++ b/ui/app/reducers/app.js
@@ -43,16 +43,6 @@ function reduceApp (state, action) {
switch (action.type) {
- case actions.TOGGLE_MENU:
- return extend(appState, {
- menuOpen: !appState.menuOpen,
- })
-
- case actions.SET_MENU_STATE:
- return extend(appState, {
- menuOpen: action.value,
- })
-
// intialize
case actions.SHOW_CREATE_VAULT: