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-08-12 20:37:38 +00:00
|
|
|
isTextOutputPlaying: false,
|
2016-07-17 23:06:43 +00:00
|
|
|
consoleEvent: {
|
|
|
|
method: undefined,
|
|
|
|
arguments: []
|
2016-07-17 23:15:13 +00:00
|
|
|
},
|
2016-07-14 16:47:54 +00:00
|
|
|
modalIsVisible: false,
|
2016-09-04 00:47:30 +00:00
|
|
|
sidebarIsExpanded: false,
|
2016-08-01 17:55:49 +00:00
|
|
|
consoleIsExpanded: false,
|
2016-08-30 03:23:10 +00:00
|
|
|
preferencesIsVisible: false,
|
|
|
|
projectOptionsVisible: false,
|
2016-09-07 02:37:29 +00:00
|
|
|
newFolderModalVisible: false,
|
2016-09-07 20:33:01 +00:00
|
|
|
shareModalVisible: false,
|
2016-09-07 21:47:22 +00:00
|
|
|
editorOptionsVisible: false,
|
|
|
|
keyboardShortcutVisible: false
|
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-08-12 20:37:38 +00:00
|
|
|
case ActionTypes.START_TEXT_OUTPUT:
|
|
|
|
return Object.assign({}, state, { isTextOutputPlaying: true });
|
|
|
|
case ActionTypes.STOP_TEXT_OUTPUT:
|
|
|
|
return Object.assign({}, state, { isTextOutputPlaying: false });
|
2016-07-17 23:06:43 +00:00
|
|
|
case ActionTypes.CONSOLE_EVENT:
|
|
|
|
return Object.assign({}, state, { consoleEvent: action.event });
|
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-07-21 04:33:41 +00:00
|
|
|
case ActionTypes.COLLAPSE_CONSOLE:
|
|
|
|
return Object.assign({}, state, { consoleIsExpanded: false });
|
|
|
|
case ActionTypes.EXPAND_CONSOLE:
|
|
|
|
return Object.assign({}, state, { consoleIsExpanded: true });
|
2016-08-01 17:55:49 +00:00
|
|
|
case ActionTypes.OPEN_PREFERENCES:
|
|
|
|
return Object.assign({}, state, { preferencesIsVisible: true });
|
|
|
|
case ActionTypes.CLOSE_PREFERENCES:
|
|
|
|
return Object.assign({}, state, { preferencesIsVisible: false });
|
2016-08-12 16:45:26 +00:00
|
|
|
case ActionTypes.RESET_PROJECT:
|
|
|
|
return initialState;
|
2016-08-30 03:23:10 +00:00
|
|
|
case ActionTypes.OPEN_PROJECT_OPTIONS:
|
|
|
|
return Object.assign({}, state, { projectOptionsVisible: true });
|
|
|
|
case ActionTypes.CLOSE_PROJECT_OPTIONS:
|
|
|
|
return Object.assign({}, state, { projectOptionsVisible: false });
|
|
|
|
case ActionTypes.SHOW_NEW_FOLDER_MODAL:
|
|
|
|
return Object.assign({}, state, { newFolderModalVisible: true });
|
|
|
|
case ActionTypes.CLOSE_NEW_FOLDER_MODAL:
|
|
|
|
return Object.assign({}, state, { newFolderModalVisible: false });
|
2016-09-07 02:37:29 +00:00
|
|
|
case ActionTypes.SHOW_SHARE_MODAL:
|
|
|
|
return Object.assign({}, state, { shareModalVisible: true });
|
|
|
|
case ActionTypes.CLOSE_SHARE_MODAL:
|
|
|
|
return Object.assign({}, state, { shareModalVisible: false });
|
2016-09-07 20:33:01 +00:00
|
|
|
case ActionTypes.SHOW_EDITOR_OPTIONS:
|
|
|
|
return Object.assign({}, state, { editorOptionsVisible: true });
|
|
|
|
case ActionTypes.CLOSE_EDITOR_OPTIONS:
|
|
|
|
return Object.assign({}, state, { editorOptionsVisible: false });
|
2016-09-07 21:47:22 +00:00
|
|
|
case ActionTypes.SHOW_KEYBOARD_SHORTCUT_MODAL:
|
|
|
|
return Object.assign({}, state, { keyboardShortcutVisible: true });
|
|
|
|
case ActionTypes.CLOSE_KEYBOARD_SHORTCUT_MODAL:
|
|
|
|
return Object.assign({}, state, { keyboardShortcutVisible: false });
|
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;
|