import * as types from 'app/types' const initialState = { transcript: false, checklist: false, nav: false, sections: { loading: true }, fullscreenTimeline: [], currentSection: null, nextSection: null, navStyle: 'white', options: { } } export default function viewerReducer(state = initialState, action) { // console.log(action.type, action) switch (action.type) { case types.viewer.toggle_component: return { ...state, [action.key]: action.value, } case types.viewer.load_sections: return { ...state, sections: action.sections, fullscreenTimeline: action.fullscreenTimeline, } case types.viewer.set_current_section: return { ...state, currentSection: action.currentSection, nextSection: action.nextSection, } case types.viewer.set_nav_style: return { ...state, navStyle: action.color, } default: return state } }