1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-22 17:33:23 +01:00

Add actions and reducers for global modal

This commit is contained in:
sdtsui 2017-08-08 13:37:16 -07:00
parent da51f56df9
commit aab0fda9ac
2 changed files with 29 additions and 0 deletions

View File

@ -5,6 +5,11 @@ var actions = {
GO_HOME: 'GO_HOME',
goHome: goHome,
// modal state
MODAL_OPEN: 'UI_MODAL_OPEN',
MODAL_CLOSE: 'UI_MODAL_CLOSE',
showModal: showModal,
hideModal: hideModal,
// sidebar state
SIDEBAR_OPEN: 'UI_SIDEBAR_OPEN',
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 () {
return {
type: actions.SIDEBAR_OPEN,

View File

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