From 483a0aa5498fc5d56c8271fbff209f753cb1c28c Mon Sep 17 00:00:00 2001 From: Melvin Valster Date: Mon, 29 Jul 2019 22:30:12 +0200 Subject: [PATCH] Add placeholder store for config --- TODO.md | 1 + src/components/Calculator.scss | 2 ++ src/store/config/actions.ts | 1 + src/store/config/reducers.ts | 14 ++++++++++++++ src/store/config/types.ts | 13 +++++++++++++ src/store/index.ts | 2 ++ src/tools/fetch-icons.ts | 2 +- 7 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 src/store/config/actions.ts create mode 100644 src/store/config/reducers.ts create mode 100644 src/store/config/types.ts diff --git a/TODO.md b/TODO.md index bb9cefa..bf6f84f 100644 --- a/TODO.md +++ b/TODO.md @@ -2,6 +2,7 @@ - [ ] Fix: Tooltips cause horizontal scroll on less-wide screens. Investigate. +- [ ] Move routing logic from `Home` into `Calculator` - [ ] Responsiveness: - [ ] Tooltips on mobile need different UX - [ ] Tooltips: diff --git a/src/components/Calculator.scss b/src/components/Calculator.scss index 65a9a38..3725933 100644 --- a/src/components/Calculator.scss +++ b/src/components/Calculator.scss @@ -1,4 +1,6 @@ .calculator { + animation: fadeIn .4s ease-out; + &__points { padding: 1em; color: white; diff --git a/src/store/config/actions.ts b/src/store/config/actions.ts new file mode 100644 index 0000000..693da49 --- /dev/null +++ b/src/store/config/actions.ts @@ -0,0 +1 @@ +export {} \ No newline at end of file diff --git a/src/store/config/reducers.ts b/src/store/config/reducers.ts new file mode 100644 index 0000000..96ed709 --- /dev/null +++ b/src/store/config/reducers.ts @@ -0,0 +1,14 @@ +import { + ConfigState, ConfigActionTypes +} from './types' + +const initialState: ConfigState = { + alwaysShowPoints: false +} + +export default function(state = initialState, action: ConfigActionTypes): ConfigState { + switch (action.type) { + default: + return state + } +} \ No newline at end of file diff --git a/src/store/config/types.ts b/src/store/config/types.ts new file mode 100644 index 0000000..ce03597 --- /dev/null +++ b/src/store/config/types.ts @@ -0,0 +1,13 @@ +export interface ConfigState { + alwaysShowPoints: boolean +} + +export const SET_CONFIG_VALUE = 'SET_CONFIG_VALUE' + +interface SetConfigValueAction { + type: typeof SET_CONFIG_VALUE + key: string + value: any +} + +export type ConfigActionTypes = SetConfigValueAction \ No newline at end of file diff --git a/src/store/index.ts b/src/store/index.ts index 46a8c4e..56296c0 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -1,8 +1,10 @@ import { createStore, combineReducers, compose } from 'redux' import calculator from './calculator/reducers' +import config from './config/reducers' const rootReducer = combineReducers({ calculator, + config }) export type AppState = ReturnType diff --git a/src/tools/fetch-icons.ts b/src/tools/fetch-icons.ts index 221426b..3e59ae3 100644 --- a/src/tools/fetch-icons.ts +++ b/src/tools/fetch-icons.ts @@ -13,7 +13,7 @@ const isSizeMissing = (icon) => (size): boolean => !fs.existsSync(getPath(icon, const getIconNames = (): string[] => { return [ - // 'inv_misc_questionmark', + 'inv_misc_questionmark', ...Object.values(spells).map(getIcon), ...Object.values(classes).map(getIcon), ...Object.values(talentsById).map(getIcon)