diff options
Diffstat (limited to 'frontend/app/views/graph/graph.reducer.js')
| -rw-r--r-- | frontend/app/views/graph/graph.reducer.js | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/frontend/app/views/graph/graph.reducer.js b/frontend/app/views/graph/graph.reducer.js index 725c256..6a30a4e 100644 --- a/frontend/app/views/graph/graph.reducer.js +++ b/frontend/app/views/graph/graph.reducer.js @@ -3,11 +3,16 @@ import * as types from 'app/types' import { crudState, crudReducer } from 'app/api/crud.reducer' +const resetEditor = { + addingPage: false, + editingPage: false, + showingAudio: false, + showingCursors: false, +} + const initialState = crudState('graph', { editor: { - addingPage: false, - editingPage: false, - showingAudio: false, + ...resetEditor, building: false, }, options: { @@ -56,9 +61,8 @@ export default function graphReducer(state = initialState, action) { ...state, editor: { ...state.editor, + ...resetEditor, addingPage: true, - editingPage: false, - showingAudio: false, } } @@ -67,8 +71,7 @@ export default function graphReducer(state = initialState, action) { ...state, editor: { ...state.editor, - addingPage: false, - showingAudio: false, + ...resetEditor, } } @@ -77,9 +80,8 @@ export default function graphReducer(state = initialState, action) { ...state, editor: { ...state.editor, + ...resetEditor, addingPage: !state.editor.addingPage, - editingPage: false, - showingAudio: false, } } @@ -88,9 +90,8 @@ export default function graphReducer(state = initialState, action) { ...state, editor: { ...state.editor, - addingPage: false, + ...resetEditor, editingPage: true, - showingAudio: false, } } @@ -99,8 +100,7 @@ export default function graphReducer(state = initialState, action) { ...state, editor: { ...state.editor, - editingPage: false, - showingAudio: false, + ...resetEditor, } } @@ -109,9 +109,8 @@ export default function graphReducer(state = initialState, action) { ...state, editor: { ...state.editor, - addingPage: false, + ...resetEditor, editingPage: !state.editor.editingPage, - showingAudio: false, } } @@ -120,12 +119,21 @@ export default function graphReducer(state = initialState, action) { ...state, editor: { ...state.editor, - addingPage: false, - editingPage: false, + ...resetEditor, showingAudio: !state.editor.showingAudio, } } + case types.graph.toggle_cursor_list: + return { + ...state, + editor: { + ...state.editor, + ...resetEditor, + showingCursors: !state.editor.showingCursors, + } + } + case types.api.loading: if (action.tag !== 'view' && action.tag !== 'export') { return state |
