blob: f513f49ce572d5f0af2bf27e55b86b5bae5d4b46 (
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
43
44
45
46
47
48
49
50
51
52
53
54
|
import { SELECT as SELECT_FLOW } from './views/main'
export const SET_ACTIVE_MENU = 'UI_SET_ACTIVE_MENU'
export const SET_CONTENT_VIEW = 'UI_SET_CONTENT_VIEW'
const defaultState = {
activeMenu: 'Start',
contentView: 'ViewAuto',
}
export default function reducer(state = defaultState, action) {
switch (action.type) {
case SET_ACTIVE_MENU:
return {
...state,
activeMenu: action.activeMenu,
}
case SELECT_FLOW:
if (action.flowId && !action.currentSelection) {
return {
...state,
activeMenu: 'Flow',
}
}
if (!action.flowId && state.activeMenu === 'Flow') {
return {
...state,
activeMenu: 'Start',
}
}
return state
case SET_CONTENT_VIEW:
return {
...state,
contentView: action.contentView,
}
default:
return state
}
}
export function setActiveMenu(activeMenu) {
return { type: SET_ACTIVE_MENU, activeMenu }
}
export function setContentView(contentView) {
return { type: SET_CONTENT_VIEW, contentView }
}
|