aboutsummaryrefslogtreecommitdiff
path: root/src/console/reducers
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2017-10-08 18:41:44 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2017-10-08 19:09:25 +0900
commitb0d2b5328107a9a2018132938fb5a9efcd77fc50 (patch)
treef66bc49efc0d7ca3a6f5af3f7330f10941cbeadd /src/console/reducers
parentf6996a2274f3293d7c5860174dd224b28877e108 (diff)
use mode in console message
Diffstat (limited to 'src/console/reducers')
-rw-r--r--src/console/reducers/index.js21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/console/reducers/index.js b/src/console/reducers/index.js
index ee9c691..78b73b0 100644
--- a/src/console/reducers/index.js
+++ b/src/console/reducers/index.js
@@ -1,9 +1,8 @@
import actions from 'console/actions';
const defaultState = {
- errorShown: false,
- errorText: '',
- commandShown: false,
+ mode: '',
+ messageText: '',
commandText: '',
completions: [],
groupSelection: -1,
@@ -48,25 +47,19 @@ export default function reducer(state = defaultState, action = {}) {
switch (action.type) {
case actions.CONSOLE_SHOW_COMMAND:
return Object.assign({}, state, {
- commandShown: true,
+ mode: 'command',
commandText: action.text,
errorShown: false,
completions: []
});
case actions.CONSOLE_SHOW_ERROR:
return Object.assign({}, state, {
- errorText: action.text,
- errorShown: true,
- commandShown: false,
+ mode: 'error',
+ messageText: action.text,
});
- case actions.CONSOLE_HIDE:
- if (state.errorShown) {
- // keep error message if shown
- return state;
- }
+ case actions.CONSOLE_HIDE_COMMAND:
return Object.assign({}, state, {
- errorShown: false,
- commandShown: false
+ mode: state.mode === 'command' ? '' : state.mode,
});
case actions.CONSOLE_SET_COMPLETIONS:
return Object.assign({}, state, {