aboutsummaryrefslogtreecommitdiff
path: root/src/console
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2018-06-28 20:44:57 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2018-06-28 20:44:57 +0900
commite2fb33bdc513385e9d71bc5b3d5068f7db9713d7 (patch)
tree28d544a6fd2237f5d0ed7809d45d783c18b9261f /src/console
parent03cf265eff0f4866959369531c2a1f5a5a0684b7 (diff)
fix but failed
Diffstat (limited to 'src/console')
-rw-r--r--src/console/reducers/index.js51
1 files changed, 22 insertions, 29 deletions
diff --git a/src/console/reducers/index.js b/src/console/reducers/index.js
index 2aec55c..71b0776 100644
--- a/src/console/reducers/index.js
+++ b/src/console/reducers/index.js
@@ -51,68 +51,61 @@ const nextConsoleText = (completions, group, item, defaults) => {
return completions[group].items[item].content;
};
+// eslint-disable-next-line max-lines-per-function
export default function reducer(state = defaultState, action = {}) {
switch (action.type) {
case actions.CONSOLE_HIDE:
- return Object.assign({}, state, {
- mode: '',
- });
+ return { ...state,
+ mode: '', };
case actions.CONSOLE_SHOW_COMMAND:
- return Object.assign({}, state, {
+ return { ...state,
mode: 'command',
consoleText: action.text,
- completions: []
- });
+ completions: []};
case actions.CONSOLE_SHOW_FIND:
- return Object.assign({}, state, {
+ return { ...state,
mode: 'find',
consoleText: '',
- completions: []
- });
+ completions: []};
case actions.CONSOLE_SHOW_ERROR:
- return Object.assign({}, state, {
+ return { ...state,
mode: 'error',
- messageText: action.text,
- });
+ messageText: action.text, };
case actions.CONSOLE_SHOW_INFO:
- return Object.assign({}, state, {
+ return { ...state,
mode: 'info',
- messageText: action.text,
- });
+ messageText: action.text, };
case actions.CONSOLE_HIDE_COMMAND:
- return Object.assign({}, state, {
+ return {
+ ...state,
mode: state.mode === 'command' || state.mode === 'find' ? '' : state.mode,
- });
+ };
case actions.CONSOLE_SET_CONSOLE_TEXT:
- return Object.assign({}, state, {
- consoleText: action.consoleText,
- });
+ return { ...state,
+ consoleText: action.consoleText, };
case actions.CONSOLE_SET_COMPLETIONS:
- return Object.assign({}, state, {
+ return { ...state,
completions: action.completions,
completionSource: action.completionSource,
groupSelection: -1,
- itemSelection: -1,
- });
+ itemSelection: -1, };
case actions.CONSOLE_COMPLETION_NEXT: {
let next = nextSelection(state);
- return Object.assign({}, state, {
+ return { ...state,
groupSelection: next[0],
itemSelection: next[1],
consoleText: nextConsoleText(
state.completions, next[0], next[1],
- state.completionSource),
- });
+ state.completionSource), };
}
case actions.CONSOLE_COMPLETION_PREV: {
let next = prevSelection(state);
- return Object.assign({}, state, {
+ return { ...state,
groupSelection: next[0],
itemSelection: next[1],
consoleText: nextConsoleText(
state.completions, next[0], next[1],
- state.completionSource),
- });
+ state.completionSource), };
}
default:
return state;