diff options
author | Joffrey Bion <joffrey.bion@booking.com> | 2020-04-06 18:55:25 +0200 |
---|---|---|
committer | Joffrey Bion <joffrey.bion@booking.com> | 2020-04-06 18:55:58 +0200 |
commit | d4d20533556928f63c8759437f67e76336bab55e (patch) | |
tree | 34e7bb151b5d21497665131b6ab8d875254e7666 /sw-ui/src/redux/currentGame.ts | |
parent | Refactoring in GameScene.kt (diff) | |
download | seven-wonders-d4d20533556928f63c8759437f67e76336bab55e.tar.gz seven-wonders-d4d20533556928f63c8759437f67e76336bab55e.tar.bz2 seven-wonders-d4d20533556928f63c8759437f67e76336bab55e.zip |
Delete old React/TypeScript UI
Diffstat (limited to 'sw-ui/src/redux/currentGame.ts')
-rw-r--r-- | sw-ui/src/redux/currentGame.ts | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/sw-ui/src/redux/currentGame.ts b/sw-ui/src/redux/currentGame.ts deleted file mode 100644 index 5e015d60..00000000 --- a/sw-ui/src/redux/currentGame.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { combineReducers } from 'redux'; -import { ApiPlayerTurnInfo, ApiTable } from '../api/model'; -import { GlobalState } from '../reducers'; -import { Action } from './actions/all'; -import { TABLE_UPDATE_RECEIVED, TURN_INFO_RECEIVED } from './actions/game'; - -export type CurrentGameState = { - turnInfo: ApiPlayerTurnInfo | null; - table: ApiTable | null; -} - -export const EMPTY_CURRENT_GAME: CurrentGameState = { - turnInfo: null, - table: null, -}; - -export function createCurrentGameReducer() { - return combineReducers({ - turnInfo: turnInfoReducer, - table: tableUpdatesReducer, - }); -} - -const turnInfoReducer = (state: ApiPlayerTurnInfo | null = null, action: Action) => { - switch (action.type) { - case TURN_INFO_RECEIVED: - return action.turnInfo; - case TABLE_UPDATE_RECEIVED: - return null; - default: - return state; - } -}; - -const tableUpdatesReducer = (state: ApiTable | null = null, action: Action) => { - switch (action.type) { - case TURN_INFO_RECEIVED: - return action.turnInfo.table; - case TABLE_UPDATE_RECEIVED: - return action.table; - default: - return state; - } -}; - -export const getCurrentTurnInfo = (state: GlobalState): ApiPlayerTurnInfo | null => state.currentGame.turnInfo; |