separate settings
This commit is contained in:
parent
541449b1fc
commit
58123210ab
13 changed files with 17 additions and 34 deletions
|
@ -1,4 +1,4 @@
|
||||||
import * as settingsActions from 'actions/setting';
|
import * as settingsActions from 'settings/actions/setting';
|
||||||
import messages from 'shared/messages';
|
import messages from 'shared/messages';
|
||||||
import BackgroundComponent from 'components/background';
|
import BackgroundComponent from 'components/background';
|
||||||
import reducers from 'reducers';
|
import reducers from 'reducers';
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import messages from 'shared/messages';
|
import messages from 'shared/messages';
|
||||||
import * as operationActions from 'actions/operation';
|
import * as operationActions from 'actions/operation';
|
||||||
import * as settingsActions from 'actions/setting';
|
import * as settingsActions from 'settings/actions/setting';
|
||||||
import * as tabActions from 'actions/tab';
|
import * as tabActions from 'actions/tab';
|
||||||
import * as commands from 'shared/commands';
|
import * as commands from 'shared/commands';
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import './console-frame.scss';
|
import './console-frame.scss';
|
||||||
import * as consoleFrames from './console-frames';
|
import * as consoleFrames from './console-frames';
|
||||||
import * as settingActions from 'actions/setting';
|
import * as settingActions from 'settings/actions/setting';
|
||||||
import { createStore } from 'store';
|
import { createStore } from 'store';
|
||||||
import ContentInputComponent from 'components/content-input';
|
import ContentInputComponent from 'components/content-input';
|
||||||
import KeymapperComponent from 'components/keymapper';
|
import KeymapperComponent from 'components/keymapper';
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import inputReducer from 'reducers/input';
|
import inputReducer from 'reducers/input';
|
||||||
import settingReducer from 'reducers/setting';
|
import settingReducer from 'settings/reducers/setting';
|
||||||
import followReducer from 'reducers/follow';
|
import followReducer from 'reducers/follow';
|
||||||
|
|
||||||
|
// Make setting reducer instead of re-use
|
||||||
const defaultState = {
|
const defaultState = {
|
||||||
input: inputReducer(undefined, {}),
|
input: inputReducer(undefined, {}),
|
||||||
setting: settingReducer(undefined, {}),
|
setting: settingReducer(undefined, {}),
|
||||||
|
|
4
src/settings/actions/index.js
Normal file
4
src/settings/actions/index.js
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
export default {
|
||||||
|
// Settings
|
||||||
|
SETTING_SET_SETTINGS: 'setting.set.settings',
|
||||||
|
};
|
|
@ -1,4 +1,4 @@
|
||||||
import actions from 'actions';
|
import actions from 'settings/actions';
|
||||||
import messages from 'shared/messages';
|
import messages from 'shared/messages';
|
||||||
import DefaultSettings from 'shared/default-settings';
|
import DefaultSettings from 'shared/default-settings';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import * as settingActions from 'actions/setting';
|
import * as settingActions from 'settings/actions/setting';
|
||||||
import { validate } from 'shared/validators/setting';
|
import { validate } from 'shared/validators/setting';
|
||||||
|
|
||||||
export default class SettingComponent {
|
export default class SettingComponent {
|
|
@ -1,6 +1,6 @@
|
||||||
import './settings.scss';
|
import './site.scss';
|
||||||
import SettingComponent from 'components/setting';
|
import SettingComponent from 'settings/components/setting';
|
||||||
import settingReducer from 'reducers/setting';
|
import settingReducer from 'settings/reducers/setting';
|
||||||
import { createStore } from 'store';
|
import { createStore } from 'store';
|
||||||
|
|
||||||
const store = createStore(settingReducer);
|
const store = createStore(settingReducer);
|
|
@ -1,4 +1,4 @@
|
||||||
import actions from 'actions';
|
import actions from 'settings/actions';
|
||||||
|
|
||||||
const defaultState = {
|
const defaultState = {
|
||||||
settings: {}
|
settings: {}
|
|
@ -1,22 +0,0 @@
|
||||||
import { expect } from "chai";
|
|
||||||
import actions from 'actions';
|
|
||||||
import settingReducer from 'reducers/setting';
|
|
||||||
|
|
||||||
describe("setting reducer", () => {
|
|
||||||
it('return the initial state', () => {
|
|
||||||
let state = settingReducer(undefined, {});
|
|
||||||
expect(state).to.have.deep.property('settings', {});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('return next state for SETTING_SET_SETTINGS', () => {
|
|
||||||
let action = {
|
|
||||||
type: actions.SETTING_SET_SETTINGS,
|
|
||||||
settings: { value1: 'hello', value2: 'world' },
|
|
||||||
};
|
|
||||||
let state = settingReducer(undefined, action);
|
|
||||||
expect(state).to.have.deep.property('settings', {
|
|
||||||
value1: 'hello',
|
|
||||||
value2: 'world',
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -7,7 +7,7 @@ const dist = path.resolve(__dirname, 'build');
|
||||||
module.exports = {
|
module.exports = {
|
||||||
entry: {
|
entry: {
|
||||||
index: path.join(src, 'content'),
|
index: path.join(src, 'content'),
|
||||||
settings: path.join(src, 'pages/settings'),
|
settings: path.join(src, 'settings'),
|
||||||
background: path.join(src, 'background'),
|
background: path.join(src, 'background'),
|
||||||
console: path.join(src, 'console')
|
console: path.join(src, 'console')
|
||||||
},
|
},
|
||||||
|
@ -50,7 +50,7 @@ module.exports = {
|
||||||
inject: false
|
inject: false
|
||||||
}),
|
}),
|
||||||
new HtmlWebpackPlugin({
|
new HtmlWebpackPlugin({
|
||||||
template: path.join(src, 'pages', 'settings.html'),
|
template: path.join(src, 'settings', 'index.html'),
|
||||||
filename: path.join(dist, 'settings.html'),
|
filename: path.join(dist, 'settings.html'),
|
||||||
inject: false
|
inject: false
|
||||||
})
|
})
|
||||||
|
|
Reference in a new issue