aboutsummaryrefslogtreecommitdiffstats
path: root/web/src/js/ducks
diff options
context:
space:
mode:
Diffstat (limited to 'web/src/js/ducks')
-rw-r--r--web/src/js/ducks/index.js2
-rw-r--r--web/src/js/ducks/ui.js25
2 files changed, 16 insertions, 11 deletions
diff --git a/web/src/js/ducks/index.js b/web/src/js/ducks/index.js
index f4ce8fa6..fee4d792 100644
--- a/web/src/js/ducks/index.js
+++ b/web/src/js/ducks/index.js
@@ -2,7 +2,7 @@ import {combineReducers} from 'redux'
import eventLog from './eventLog'
import websocket from './websocket'
import flows from './flows'
-import ui from './ui.js'
+import ui from './ui'
const rootReducer = combineReducers({
eventLog,
diff --git a/web/src/js/ducks/ui.js b/web/src/js/ducks/ui.js
index 26420e0d..28a13ea4 100644
--- a/web/src/js/ducks/ui.js
+++ b/web/src/js/ducks/ui.js
@@ -3,23 +3,28 @@ const SET_ACTIVE_MENU = 'SET_ACTIVE_MENU'
const defaultState = {
- active_menu: 'Start'
+ activeMenu: 'Start',
}
export default function reducer(state = defaultState, action) {
switch (action.type) {
case SET_ACTIVE_MENU:
return {
...state,
- active_menu: action.active_menu
+ activeMenu: action.activeMenu
}
case SELECT_FLOW:
- let isNewSelection = (action.flowId && !action.currentSelection)
- let isSelectAction = action.flowId
- if (isNewSelection){
- let wasFlowSelected = state.active_menu == 'Flow'
- return{
+ let isNewSelect = (action.flowId && !action.currentSelection)
+ let isDeselect = (!action.flowId && action.currentSelection)
+ if(isNewSelect) {
+ return {
...state,
- active_menu: isSelectAction ? 'Flow' : (wasFlowSelected ? 'Start' : state.active_menu)
+ activeMenu: "Flow"
+ }
+ }
+ if(isDeselect && state.activeMenu === "Flow") {
+ return {
+ ...state,
+ activeMenu: "Start"
}
}
return state
@@ -28,10 +33,10 @@ export default function reducer(state = defaultState, action) {
}
}
-export function setActiveMenu(active_menu) {
+export function setActiveMenu(activeMenu) {
return {
type: SET_ACTIVE_MENU,
- active_menu
+ activeMenu
}
}