* break auth panel render into submethods * move var definition * break renderUnathorized into submethods * hide login providers behind dropdown if they are exceed length of 3 * amend dropdown to behave nicely being placed in another dropdown * add style to providers enclosed in dropdown * add provider reducer and actions * add provider save/restore to app flow * place last login provider first in providers list * infer StoreState from combineReducers return type * move collapsed threads retoration to action * fix: provider lost in other * add dynamic threshold depending on window width * fix & add tests
36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
import { createStore, applyMiddleware, AnyAction, compose } from 'redux';
|
|
import { combineReducers } from 'redux';
|
|
import thunk, { ThunkAction, ThunkDispatch } from 'redux-thunk';
|
|
import storeReducers from './reducers';
|
|
import { ACTIONS } from './actions';
|
|
|
|
const reducers = combineReducers(storeReducers);
|
|
|
|
export type StoreState = ReturnType<typeof reducers>;
|
|
|
|
const middleware = applyMiddleware(thunk);
|
|
|
|
/**
|
|
* Thunk Action shortcut
|
|
*/
|
|
export type StoreAction<R, A extends AnyAction = ACTIONS> = ThunkAction<R, StoreState, undefined, A>;
|
|
|
|
/**
|
|
* Thunk Dispatch shortcut
|
|
*/
|
|
export type StoreDispatch = ThunkDispatch<StoreState, undefined, ACTIONS>;
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
const composeEnhancers = (window as any).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
|
|
? // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
(window as any).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
|
|
: compose;
|
|
const store = createStore(reducers, composeEnhancers(middleware));
|
|
|
|
if (process.env.NODE_ENV === 'development') {
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
(window as any).ReduxStore = store;
|
|
}
|
|
|
|
export default store;
|