diff --git a/js/reducers/userInput.js b/js/reducers/userInput.js deleted file mode 100644 index 88d0c28a..00000000 --- a/js/reducers/userInput.js +++ /dev/null @@ -1,36 +0,0 @@ -import { - SET_FOCUS, - SET_BAND_FOCUS, - SET_SCRUB_POSITION, - UNSET_FOCUS, - SET_USER_MESSAGE, - UNSET_USER_MESSAGE -} from "../actionTypes"; - -const defaultUserInput = { - focus: null, - bandFocused: null, - scrubPosition: 0, - userMessage: null -}; - -export const userInput = (state = defaultUserInput, action) => { - switch (action.type) { - case SET_FOCUS: - return { ...state, focus: action.input, bandFocused: null }; - case SET_BAND_FOCUS: - return { ...state, focus: action.input, bandFocused: action.bandFocused }; - case UNSET_FOCUS: - return { ...state, focus: null, bandFocused: null }; - case SET_SCRUB_POSITION: - return { ...state, scrubPosition: action.position }; - case SET_USER_MESSAGE: - return { ...state, userMessage: action.message }; - case UNSET_USER_MESSAGE: - return { ...state, userMessage: null }; - default: - return state; - } -}; - -export default userInput; diff --git a/js/types.ts b/js/types.ts index d2030c18..df85286e 100644 --- a/js/types.ts +++ b/js/types.ts @@ -55,6 +55,22 @@ export type Action = type: "TOGGLE_REPEAT"; } | { type: "TOGGLE_SHUFFLE"; + } | { + type: "SET_FOCUS"; + input: string; + } | { + type: "SET_BAND_FOCUS"; + input: string; + } | { + type: "UNSET_FOCUS"; + } | { + type: "SET_SCRUB_POSITION"; + position: number; + } | { + type: "SET_USER_MESSAGE"; + message: string; + } | { + type: "UNSET_USER_MESSAGE"; }; export interface SettingsState { @@ -78,3 +94,10 @@ export interface MediaState { repeat: boolean; status: string | null; // TODO: Convert this to an enum } + +export interface UserInputState { + focus: string | null; // TODO: Convert this to an enum? + bandFocused: null; + scrubPosition: number; + userMessage: string | null; +} \ No newline at end of file