Add actions and reducers for global modal

feature/default_network_editable
sdtsui 7 years ago
parent da51f56df9
commit aab0fda9ac
  1. 17
      ui/app/actions.js
  2. 12
      ui/app/reducers/app.js

@ -5,6 +5,11 @@ var actions = {
GO_HOME: 'GO_HOME', GO_HOME: 'GO_HOME',
goHome: goHome, goHome: goHome,
// modal state
MODAL_OPEN: 'UI_MODAL_OPEN',
MODAL_CLOSE: 'UI_MODAL_CLOSE',
showModal: showModal,
hideModal: hideModal,
// sidebar state // sidebar state
SIDEBAR_OPEN: 'UI_SIDEBAR_OPEN', SIDEBAR_OPEN: 'UI_SIDEBAR_OPEN',
SIDEBAR_CLOSE: 'UI_SIDEBAR_CLOSE', SIDEBAR_CLOSE: 'UI_SIDEBAR_CLOSE',
@ -768,6 +773,18 @@ function useEtherscanProvider () {
} }
} }
function showModal () {
return {
type: actions.MODAL_OPEN,
}
}
function hideModal () {
return {
type: actions.MODAL_CLOSE,
}
}
function showSidebar () { function showSidebar () {
return { return {
type: actions.SIDEBAR_OPEN, type: actions.SIDEBAR_OPEN,

@ -36,6 +36,7 @@ function reduceApp (state, action) {
var appState = extend({ var appState = extend({
shouldClose: false, shouldClose: false,
menuOpen: false, menuOpen: false,
modalOpen: false,
sidebarOpen: false, sidebarOpen: false,
currentView: seedWords ? seedConfView : defaultView, currentView: seedWords ? seedConfView : defaultView,
accountDetail: { accountDetail: {
@ -58,6 +59,17 @@ function reduceApp (state, action) {
sidebarOpen: false, sidebarOpen: false,
}) })
// modal methods:
case actions.MODAL_OPEN:
return extend(appState, {
modalOpen: true,
})
case actions.MODAL_CLOSE:
return extend(appState, {
modalOpen: false,
})
// transition methods // transition methods
case actions.TRANSITION_FORWARD: case actions.TRANSITION_FORWARD:

Loading…
Cancel
Save