separate settings

jh-changes
Shin'ya Ueoka 7 years ago
parent 541449b1fc
commit 58123210ab
  1. 2
      src/background/index.js
  2. 2
      src/components/background.js
  3. 2
      src/content/index.js
  4. 3
      src/reducers/index.js
  5. 4
      src/settings/actions/index.js
  6. 2
      src/settings/actions/setting.js
  7. 2
      src/settings/components/setting.js
  8. 0
      src/settings/index.html
  9. 6
      src/settings/index.js
  10. 2
      src/settings/reducers/setting.js
  11. 0
      src/settings/site.scss
  12. 22
      test/reducers/setting.test.js
  13. 4
      webpack.config.js

@ -1,4 +1,4 @@
import * as settingsActions from 'actions/setting';
import * as settingsActions from 'settings/actions/setting';
import messages from 'shared/messages';
import BackgroundComponent from 'components/background';
import reducers from 'reducers';

@ -1,6 +1,6 @@
import messages from 'shared/messages';
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 commands from 'shared/commands';

@ -1,6 +1,6 @@
import './console-frame.scss';
import * as consoleFrames from './console-frames';
import * as settingActions from 'actions/setting';
import * as settingActions from 'settings/actions/setting';
import { createStore } from 'store';
import ContentInputComponent from 'components/content-input';
import KeymapperComponent from 'components/keymapper';

@ -1,7 +1,8 @@
import inputReducer from 'reducers/input';
import settingReducer from 'reducers/setting';
import settingReducer from 'settings/reducers/setting';
import followReducer from 'reducers/follow';
// Make setting reducer instead of re-use
const defaultState = {
input: inputReducer(undefined, {}),
setting: settingReducer(undefined, {}),

@ -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 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';
export default class SettingComponent {

@ -1,6 +1,6 @@
import './settings.scss';
import SettingComponent from 'components/setting';
import settingReducer from 'reducers/setting';
import './site.scss';
import SettingComponent from 'settings/components/setting';
import settingReducer from 'settings/reducers/setting';
import { createStore } from 'store';
const store = createStore(settingReducer);

@ -1,4 +1,4 @@
import actions from 'actions';
import actions from 'settings/actions';
const defaultState = {
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 = {
entry: {
index: path.join(src, 'content'),
settings: path.join(src, 'pages/settings'),
settings: path.join(src, 'settings'),
background: path.join(src, 'background'),
console: path.join(src, 'console')
},
@ -50,7 +50,7 @@ module.exports = {
inject: false
}),
new HtmlWebpackPlugin({
template: path.join(src, 'pages', 'settings.html'),
template: path.join(src, 'settings', 'index.html'),
filename: path.join(dist, 'settings.html'),
inject: false
})