import ReduxThunk from 'redux-thunk' import { SELECT_FLOW } from './flows' const ACTIVE_MENU = 'ACTIVE_MENU' const defaultState = { active_menu: 'Start' } export default function reducer(state = defaultState, action) { switch (action.type) { case ACTIVE_MENU: return { ...state, active_menu: action.active_menu } case SELECT_FLOW: if (!action.currentSelection != !action.flowId){ return{ ...state, active_menu: action.flowId ? 'Flow' : (state.active_menu == 'Flow' ? 'Start' : state.active_menu) } } return state default: return state } } export function setActiveMenu(active_menu) { return { type: ACTIVE_MENU, active_menu } }