diff options
Diffstat (limited to 'app/client/live/reducer.js')
| -rw-r--r-- | app/client/live/reducer.js | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/app/client/live/reducer.js b/app/client/live/reducer.js index 8fa6edd..60bcb41 100644 --- a/app/client/live/reducer.js +++ b/app/client/live/reducer.js @@ -1,6 +1,6 @@ -import { combineReducers } from 'redux' import moment from 'moment' -let FileSaver = require('file-saver') +import FileSaver from 'file-saver' +import types from '../types' const liveInitialState = { loading: false, @@ -17,7 +17,7 @@ const liveReducer = (state = liveInitialState, action) => { let results; switch(action.type) { - case 'LOAD_PARAMS': + case types.player.load_params: if (! action.opt || ! Object.keys(action.opt).length) { return state } @@ -28,7 +28,7 @@ const liveReducer = (state = liveInitialState, action) => { opt: action.opt, } - case 'SET_PARAM': + case types.player.set_param: return { ...state, opt: { @@ -37,14 +37,14 @@ const liveReducer = (state = liveInitialState, action) => { } } - case 'LIST_CHECKPOINTS': + case types.player.list_checkpoints: return { ...state, checkpoints: action.checkpoints, epochs: [], } - case 'LIST_EPOCHS': + case types.player.list_epochs: return { ...state, epochs: (action.epochs || []).map(a => [ a == 'latest' ? Infinity : a, a ]) @@ -52,25 +52,25 @@ const liveReducer = (state = liveInitialState, action) => { .map(a => a[1]) } - case 'LIST_SEQUENCES': + case types.player.list_sequences: return { ...state, sequences: action.sequences, } - case 'SET_FPS': + case types.player.set_fps: return { ...state, fps: action.fps, } - case 'CURRENT_FRAME': + case types.player.current_frame: return action.meta ? { ...state, frame: action.meta } : state - case 'START_RECORDING': + case types.player.start_recording: return { ...state, opt: { @@ -78,7 +78,7 @@ const liveReducer = (state = liveInitialState, action) => { recording: true, } } - case 'ADD_RECORD_FRAME': + case types.player.add_record_frame: return { ...state, opt: { @@ -87,7 +87,7 @@ const liveReducer = (state = liveInitialState, action) => { } } - case 'SAVE_FRAME': + case types.player.save_frame: FileSaver.saveAs( action.blob, state.opt.checkpoint_name + "_" + @@ -96,7 +96,7 @@ const liveReducer = (state = liveInitialState, action) => { ) return state - case 'SAVING_VIDEO': + case types.player.saving_video: return { ...state, opt: { @@ -104,7 +104,7 @@ const liveReducer = (state = liveInitialState, action) => { savingVideo: true, } } - case 'SAVE_VIDEO': + case types.player.save_video: FileSaver.saveAs( action.blob, state.opt.checkpoint_name + "_" + |
