diff options
-rw-r--r-- | src/background/index.js | 2 | ||||
-rw-r--r-- | src/components/background.js | 2 | ||||
-rw-r--r-- | src/content/index.js | 2 | ||||
-rw-r--r-- | src/reducers/index.js | 3 | ||||
-rw-r--r-- | src/settings/actions/index.js | 4 | ||||
-rw-r--r-- | src/settings/actions/setting.js (renamed from src/actions/setting.js) | 2 | ||||
-rw-r--r-- | src/settings/components/setting.js (renamed from src/components/setting.js) | 2 | ||||
-rw-r--r-- | src/settings/index.html (renamed from src/pages/settings.html) | 0 | ||||
-rw-r--r-- | src/settings/index.js (renamed from src/pages/settings.js) | 6 | ||||
-rw-r--r-- | src/settings/reducers/setting.js (renamed from src/reducers/setting.js) | 2 | ||||
-rw-r--r-- | src/settings/site.scss (renamed from src/pages/settings.scss) | 0 | ||||
-rw-r--r-- | test/reducers/setting.test.js | 22 | ||||
-rw-r--r-- | webpack.config.js | 4 |
13 files changed, 17 insertions, 34 deletions
diff --git a/src/background/index.js b/src/background/index.js index 63d13cb..c51754b 100644 --- a/src/background/index.js +++ b/src/background/index.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'; diff --git a/src/components/background.js b/src/components/background.js index afb90c2..200fedf 100644 --- a/src/components/background.js +++ b/src/components/background.js @@ -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'; diff --git a/src/content/index.js b/src/content/index.js index 25a2e74..edca510 100644 --- a/src/content/index.js +++ b/src/content/index.js @@ -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'; diff --git a/src/reducers/index.js b/src/reducers/index.js index 3ebe491..9c86ebf 100644 --- a/src/reducers/index.js +++ b/src/reducers/index.js @@ -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, {}), diff --git a/src/settings/actions/index.js b/src/settings/actions/index.js new file mode 100644 index 0000000..8c212c2 --- /dev/null +++ b/src/settings/actions/index.js @@ -0,0 +1,4 @@ +export default { + // Settings + SETTING_SET_SETTINGS: 'setting.set.settings', +}; diff --git a/src/actions/setting.js b/src/settings/actions/setting.js index c241428..697bcf0 100644 --- a/src/actions/setting.js +++ b/src/settings/actions/setting.js @@ -1,4 +1,4 @@ -import actions from 'actions'; +import actions from 'settings/actions'; import messages from 'shared/messages'; import DefaultSettings from 'shared/default-settings'; diff --git a/src/components/setting.js b/src/settings/components/setting.js index c2f99b6..14482a3 100644 --- a/src/components/setting.js +++ b/src/settings/components/setting.js @@ -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 { diff --git a/src/pages/settings.html b/src/settings/index.html index 99d6c6b..99d6c6b 100644 --- a/src/pages/settings.html +++ b/src/settings/index.html diff --git a/src/pages/settings.js b/src/settings/index.js index 6e25e6f..8c60f80 100644 --- a/src/pages/settings.js +++ b/src/settings/index.js @@ -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); diff --git a/src/reducers/setting.js b/src/settings/reducers/setting.js index 7326ed7..f7d9242 100644 --- a/src/reducers/setting.js +++ b/src/settings/reducers/setting.js @@ -1,4 +1,4 @@ -import actions from 'actions'; +import actions from 'settings/actions'; const defaultState = { settings: {} diff --git a/src/pages/settings.scss b/src/settings/site.scss index 5707c8a..5707c8a 100644 --- a/src/pages/settings.scss +++ b/src/settings/site.scss diff --git a/test/reducers/setting.test.js b/test/reducers/setting.test.js deleted file mode 100644 index 1af031a..0000000 --- a/test/reducers/setting.test.js +++ /dev/null @@ -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', - }); - }); -}); diff --git a/webpack.config.js b/webpack.config.js index 486814a..bc3bb1c 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -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 }) |