separate console

This commit is contained in:
Shin'ya Ueoka 2017-10-08 14:18:12 +09:00
parent 22db12f2a3
commit 541449b1fc
13 changed files with 38 additions and 40 deletions

View file

@ -1,12 +1,4 @@
export default {
// console commands
CONSOLE_SHOW_COMMAND: 'console.show.command',
CONSOLE_SET_COMPLETIONS: 'console.set.completions',
CONSOLE_SHOW_ERROR: 'console.show.error',
CONSOLE_HIDE: 'console.hide',
CONSOLE_COMPLETION_NEXT: 'console.completion.next',
CONSOLE_COMPLETION_PREV: 'console.completion.prev',
// User input
INPUT_KEY_PRESS: 'input.key,press',
INPUT_CLEAR_KEYS: 'input.clear.keys',

View file

@ -1,4 +1,4 @@
import actions from 'actions';
import actions from 'console/actions';
const showCommand = (text) => {
return {

View file

@ -0,0 +1,9 @@
export default {
// console commands
CONSOLE_SHOW_COMMAND: 'console.show.command',
CONSOLE_SET_COMPLETIONS: 'console.set.completions',
CONSOLE_SHOW_ERROR: 'console.show.error',
CONSOLE_HIDE: 'console.hide',
CONSOLE_COMPLETION_NEXT: 'console.completion.next',
CONSOLE_COMPLETION_PREV: 'console.completion.prev',
};

View file

@ -6,7 +6,7 @@ export default class Completion {
}
update() {
let state = this.store.getState().console;
let state = this.store.getState();
if (JSON.stringify(this.prevState) === JSON.stringify(state)) {
return;
}

View file

@ -1,5 +1,5 @@
import messages from 'shared/messages';
import * as consoleActions from 'actions/console';
import * as consoleActions from 'console/actions/console';
export default class ConsoleComponent {
constructor(wrapper, store) {
@ -71,7 +71,7 @@ export default class ConsoleComponent {
}
update() {
let state = this.store.getState().console;
let state = this.store.getState();
if (!this.prevState.commandShown && state.commandShown) {
this.showCommand(state.commandText);
} else if (!state.commandShown) {

View file

@ -1,10 +1,10 @@
import './console.scss';
import './site.scss';
import messages from 'shared/messages';
import CompletionComponent from 'components/completion';
import ConsoleComponent from 'components/console';
import reducers from 'reducers';
import CompletionComponent from 'console/components/completion';
import ConsoleComponent from 'console/components/console';
import reducers from 'console/reducers';
import { createStore } from 'store';
import * as consoleActions from 'actions/console';
import * as consoleActions from 'console/actions/console';
const store = createStore(reducers);
let completionComponent = null;

View file

@ -1,4 +1,4 @@
import actions from 'actions';
import actions from 'console/actions';
const defaultState = {
errorShown: false,

View file

@ -1,11 +1,9 @@
import inputReducer from 'reducers/input';
import consoleReducer from 'reducers/console';
import settingReducer from 'reducers/setting';
import followReducer from 'reducers/follow';
const defaultState = {
input: inputReducer(undefined, {}),
console: consoleReducer(undefined, {}),
setting: settingReducer(undefined, {}),
follow: followReducer(undefined, {}),
};
@ -13,7 +11,6 @@ const defaultState = {
export default function reducer(state = defaultState, action = {}) {
return Object.assign({}, state, {
input: inputReducer(state.input, action),
console: consoleReducer(state.console, action),
setting: settingReducer(state.setting, action),
follow: followReducer(state.follow, action),
});