2016-06-22 19:58:23 +00:00
|
|
|
import * as ActionTypes from '../../../constants';
|
2016-05-11 20:13:17 +00:00
|
|
|
|
|
|
|
const initialState = {
|
2016-07-08 18:57:22 +00:00
|
|
|
isPlaying: false,
|
2016-07-13 20:13:28 +00:00
|
|
|
selectedFile: '1',
|
2016-07-14 16:47:54 +00:00
|
|
|
modalIsVisible: false,
|
|
|
|
sidebarIsExpanded: true
|
2016-06-23 22:29:55 +00:00
|
|
|
};
|
2016-05-11 20:13:17 +00:00
|
|
|
|
|
|
|
const ide = (state = initialState, action) => {
|
2016-06-23 22:29:55 +00:00
|
|
|
switch (action.type) {
|
|
|
|
case ActionTypes.TOGGLE_SKETCH:
|
2016-07-11 19:22:29 +00:00
|
|
|
return Object.assign({}, state, { isPlaying: !state.isPlaying });
|
2016-06-23 22:29:55 +00:00
|
|
|
case ActionTypes.START_SKETCH:
|
2016-07-11 19:22:29 +00:00
|
|
|
return Object.assign({}, state, { isPlaying: true });
|
2016-06-23 22:29:55 +00:00
|
|
|
case ActionTypes.STOP_SKETCH:
|
2016-07-11 19:22:29 +00:00
|
|
|
return Object.assign({}, state, { isPlaying: false });
|
2016-07-08 18:57:22 +00:00
|
|
|
case ActionTypes.SET_SELECTED_FILE:
|
|
|
|
case ActionTypes.SET_PROJECT:
|
|
|
|
case ActionTypes.NEW_PROJECT:
|
|
|
|
return Object.assign({}, state, { selectedFile: action.selectedFile });
|
2016-07-13 20:13:28 +00:00
|
|
|
case ActionTypes.SHOW_MODAL:
|
|
|
|
return Object.assign({}, state, { modalIsVisible: true });
|
|
|
|
case ActionTypes.HIDE_MODAL:
|
|
|
|
return Object.assign({}, state, { modalIsVisible: false });
|
2016-07-14 16:47:54 +00:00
|
|
|
case ActionTypes.COLLAPSE_SIDEBAR:
|
|
|
|
return Object.assign({}, state, { sidebarIsExpanded: false });
|
|
|
|
case ActionTypes.EXPAND_SIDEBAR:
|
|
|
|
return Object.assign({}, state, { sidebarIsExpanded: true });
|
2016-06-23 22:29:55 +00:00
|
|
|
default:
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
};
|
2016-05-11 20:13:17 +00:00
|
|
|
|
2016-06-23 22:29:55 +00:00
|
|
|
export default ide;
|