From c60d0e7392fc708e961614d6b756a045de74f458 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Tue, 30 Apr 2019 14:00:07 +0900 Subject: Rename .js/.jsx to .ts/.tsx --- src/content/reducers/addon.js | 15 --------------- src/content/reducers/addon.ts | 15 +++++++++++++++ src/content/reducers/find.js | 17 ----------------- src/content/reducers/find.ts | 17 +++++++++++++++++ src/content/reducers/follow-controller.js | 30 ------------------------------ src/content/reducers/follow-controller.ts | 30 ++++++++++++++++++++++++++++++ src/content/reducers/index.js | 11 ----------- src/content/reducers/index.ts | 11 +++++++++++ src/content/reducers/input.js | 18 ------------------ src/content/reducers/input.ts | 18 ++++++++++++++++++ src/content/reducers/mark.js | 25 ------------------------- src/content/reducers/mark.ts | 25 +++++++++++++++++++++++++ src/content/reducers/setting.js | 16 ---------------- src/content/reducers/setting.ts | 16 ++++++++++++++++ 14 files changed, 132 insertions(+), 132 deletions(-) delete mode 100644 src/content/reducers/addon.js create mode 100644 src/content/reducers/addon.ts delete mode 100644 src/content/reducers/find.js create mode 100644 src/content/reducers/find.ts delete mode 100644 src/content/reducers/follow-controller.js create mode 100644 src/content/reducers/follow-controller.ts delete mode 100644 src/content/reducers/index.js create mode 100644 src/content/reducers/index.ts delete mode 100644 src/content/reducers/input.js create mode 100644 src/content/reducers/input.ts delete mode 100644 src/content/reducers/mark.js create mode 100644 src/content/reducers/mark.ts delete mode 100644 src/content/reducers/setting.js create mode 100644 src/content/reducers/setting.ts (limited to 'src/content/reducers') diff --git a/src/content/reducers/addon.js b/src/content/reducers/addon.js deleted file mode 100644 index 0def55a..0000000 --- a/src/content/reducers/addon.js +++ /dev/null @@ -1,15 +0,0 @@ -import actions from 'content/actions'; - -const defaultState = { - enabled: true, -}; - -export default function reducer(state = defaultState, action = {}) { - switch (action.type) { - case actions.ADDON_SET_ENABLED: - return { ...state, - enabled: action.enabled, }; - default: - return state; - } -} diff --git a/src/content/reducers/addon.ts b/src/content/reducers/addon.ts new file mode 100644 index 0000000..0def55a --- /dev/null +++ b/src/content/reducers/addon.ts @@ -0,0 +1,15 @@ +import actions from 'content/actions'; + +const defaultState = { + enabled: true, +}; + +export default function reducer(state = defaultState, action = {}) { + switch (action.type) { + case actions.ADDON_SET_ENABLED: + return { ...state, + enabled: action.enabled, }; + default: + return state; + } +} diff --git a/src/content/reducers/find.js b/src/content/reducers/find.js deleted file mode 100644 index 4560e2c..0000000 --- a/src/content/reducers/find.js +++ /dev/null @@ -1,17 +0,0 @@ -import actions from 'content/actions'; - -const defaultState = { - keyword: null, - found: false, -}; - -export default function reducer(state = defaultState, action = {}) { - switch (action.type) { - case actions.FIND_SET_KEYWORD: - return { ...state, - keyword: action.keyword, - found: action.found, }; - default: - return state; - } -} diff --git a/src/content/reducers/find.ts b/src/content/reducers/find.ts new file mode 100644 index 0000000..4560e2c --- /dev/null +++ b/src/content/reducers/find.ts @@ -0,0 +1,17 @@ +import actions from 'content/actions'; + +const defaultState = { + keyword: null, + found: false, +}; + +export default function reducer(state = defaultState, action = {}) { + switch (action.type) { + case actions.FIND_SET_KEYWORD: + return { ...state, + keyword: action.keyword, + found: action.found, }; + default: + return state; + } +} diff --git a/src/content/reducers/follow-controller.js b/src/content/reducers/follow-controller.js deleted file mode 100644 index 5869c47..0000000 --- a/src/content/reducers/follow-controller.js +++ /dev/null @@ -1,30 +0,0 @@ -import actions from 'content/actions'; - -const defaultState = { - enabled: false, - newTab: false, - background: false, - keys: '', -}; - -export default function reducer(state = defaultState, action = {}) { - switch (action.type) { - case actions.FOLLOW_CONTROLLER_ENABLE: - return { ...state, - enabled: true, - newTab: action.newTab, - background: action.background, - keys: '', }; - case actions.FOLLOW_CONTROLLER_DISABLE: - return { ...state, - enabled: false, }; - case actions.FOLLOW_CONTROLLER_KEY_PRESS: - return { ...state, - keys: state.keys + action.key, }; - case actions.FOLLOW_CONTROLLER_BACKSPACE: - return { ...state, - keys: state.keys.slice(0, -1), }; - default: - return state; - } -} diff --git a/src/content/reducers/follow-controller.ts b/src/content/reducers/follow-controller.ts new file mode 100644 index 0000000..5869c47 --- /dev/null +++ b/src/content/reducers/follow-controller.ts @@ -0,0 +1,30 @@ +import actions from 'content/actions'; + +const defaultState = { + enabled: false, + newTab: false, + background: false, + keys: '', +}; + +export default function reducer(state = defaultState, action = {}) { + switch (action.type) { + case actions.FOLLOW_CONTROLLER_ENABLE: + return { ...state, + enabled: true, + newTab: action.newTab, + background: action.background, + keys: '', }; + case actions.FOLLOW_CONTROLLER_DISABLE: + return { ...state, + enabled: false, }; + case actions.FOLLOW_CONTROLLER_KEY_PRESS: + return { ...state, + keys: state.keys + action.key, }; + case actions.FOLLOW_CONTROLLER_BACKSPACE: + return { ...state, + keys: state.keys.slice(0, -1), }; + default: + return state; + } +} diff --git a/src/content/reducers/index.js b/src/content/reducers/index.js deleted file mode 100644 index bf612a3..0000000 --- a/src/content/reducers/index.js +++ /dev/null @@ -1,11 +0,0 @@ -import { combineReducers } from 'redux'; -import addon from './addon'; -import find from './find'; -import setting from './setting'; -import input from './input'; -import followController from './follow-controller'; -import mark from './mark'; - -export default combineReducers({ - addon, find, setting, input, followController, mark, -}); diff --git a/src/content/reducers/index.ts b/src/content/reducers/index.ts new file mode 100644 index 0000000..bf612a3 --- /dev/null +++ b/src/content/reducers/index.ts @@ -0,0 +1,11 @@ +import { combineReducers } from 'redux'; +import addon from './addon'; +import find from './find'; +import setting from './setting'; +import input from './input'; +import followController from './follow-controller'; +import mark from './mark'; + +export default combineReducers({ + addon, find, setting, input, followController, mark, +}); diff --git a/src/content/reducers/input.js b/src/content/reducers/input.js deleted file mode 100644 index 23e7dd2..0000000 --- a/src/content/reducers/input.js +++ /dev/null @@ -1,18 +0,0 @@ -import actions from 'content/actions'; - -const defaultState = { - keys: [] -}; - -export default function reducer(state = defaultState, action = {}) { - switch (action.type) { - case actions.INPUT_KEY_PRESS: - return { ...state, - keys: state.keys.concat([action.key]), }; - case actions.INPUT_CLEAR_KEYS: - return { ...state, - keys: [], }; - default: - return state; - } -} diff --git a/src/content/reducers/input.ts b/src/content/reducers/input.ts new file mode 100644 index 0000000..23e7dd2 --- /dev/null +++ b/src/content/reducers/input.ts @@ -0,0 +1,18 @@ +import actions from 'content/actions'; + +const defaultState = { + keys: [] +}; + +export default function reducer(state = defaultState, action = {}) { + switch (action.type) { + case actions.INPUT_KEY_PRESS: + return { ...state, + keys: state.keys.concat([action.key]), }; + case actions.INPUT_CLEAR_KEYS: + return { ...state, + keys: [], }; + default: + return state; + } +} diff --git a/src/content/reducers/mark.js b/src/content/reducers/mark.js deleted file mode 100644 index 2c96cc5..0000000 --- a/src/content/reducers/mark.js +++ /dev/null @@ -1,25 +0,0 @@ -import actions from 'content/actions'; - -const defaultState = { - setMode: false, - jumpMode: false, - marks: {}, -}; - -export default function reducer(state = defaultState, action = {}) { - switch (action.type) { - case actions.MARK_START_SET: - return { ...state, setMode: true }; - case actions.MARK_START_JUMP: - return { ...state, jumpMode: true }; - case actions.MARK_CANCEL: - return { ...state, setMode: false, jumpMode: false }; - case actions.MARK_SET_LOCAL: { - let marks = { ...state.marks }; - marks[action.key] = { x: action.x, y: action.y }; - return { ...state, setMode: false, marks }; - } - default: - return state; - } -} diff --git a/src/content/reducers/mark.ts b/src/content/reducers/mark.ts new file mode 100644 index 0000000..2c96cc5 --- /dev/null +++ b/src/content/reducers/mark.ts @@ -0,0 +1,25 @@ +import actions from 'content/actions'; + +const defaultState = { + setMode: false, + jumpMode: false, + marks: {}, +}; + +export default function reducer(state = defaultState, action = {}) { + switch (action.type) { + case actions.MARK_START_SET: + return { ...state, setMode: true }; + case actions.MARK_START_JUMP: + return { ...state, jumpMode: true }; + case actions.MARK_CANCEL: + return { ...state, setMode: false, jumpMode: false }; + case actions.MARK_SET_LOCAL: { + let marks = { ...state.marks }; + marks[action.key] = { x: action.x, y: action.y }; + return { ...state, setMode: false, marks }; + } + default: + return state; + } +} diff --git a/src/content/reducers/setting.js b/src/content/reducers/setting.js deleted file mode 100644 index a49db6d..0000000 --- a/src/content/reducers/setting.js +++ /dev/null @@ -1,16 +0,0 @@ -import actions from 'content/actions'; - -const defaultState = { - // keymaps is and arrays of key-binding pairs, which is entries of Map - keymaps: [], -}; - -export default function reducer(state = defaultState, action = {}) { - switch (action.type) { - case actions.SETTING_SET: - return { ...action.value }; - default: - return state; - } -} - diff --git a/src/content/reducers/setting.ts b/src/content/reducers/setting.ts new file mode 100644 index 0000000..a49db6d --- /dev/null +++ b/src/content/reducers/setting.ts @@ -0,0 +1,16 @@ +import actions from 'content/actions'; + +const defaultState = { + // keymaps is and arrays of key-binding pairs, which is entries of Map + keymaps: [], +}; + +export default function reducer(state = defaultState, action = {}) { + switch (action.type) { + case actions.SETTING_SET: + return { ...action.value }; + default: + return state; + } +} + -- cgit v1.2.3