blob: f8234fdbd956204ab0e74c8c77c6b54e5555cba1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
import {SELECT} from "./views/main"
export const SET_ACTIVE_MENU = 'SET_ACTIVE_MENU';
const defaultState = {
activeMenu: 'Start',
}
export default function reducer(state = defaultState, action) {
switch (action.type) {
case SET_ACTIVE_MENU:
return {
...state,
activeMenu: action.activeMenu
}
case SELECT:
let isNewSelect = (action.flowId && !action.currentSelection)
let isDeselect = (!action.flowId && action.currentSelection)
if(isNewSelect) {
return {
...state,
activeMenu: "Flow"
}
}
if(isDeselect && state.activeMenu === "Flow") {
return {
...state,
activeMenu: "Start"
}
}
return state
default:
return state
}
}
export function setActiveMenu(activeMenu) {
return {
type: SET_ACTIVE_MENU,
activeMenu
}
}
|