[MIRROR] [TGUI 5.0 Prep] Removes context (#7455)

Co-authored-by: Selis <sirlionfur@hotmail.de>
Co-authored-by: Selis <selis@xynolabs.com>
This commit is contained in:
CHOMPStation2
2024-02-07 15:37:37 -07:00
committed by GitHub
parent 8e448db4a1
commit c96b18a2d3
308 changed files with 1861 additions and 2440 deletions

View File

@@ -0,0 +1,47 @@
/**
* @file
* @copyright 2020 Aleksej Komarov
* @license MIT
*/
import { connectionLost } from './actions';
import { connectionRestored, dismissWarning } from './actions';
const initialState = {
// TODO: This is where round info should be.
roundId: null,
roundTime: null,
roundRestartedAt: null,
connectionLostAt: null,
dismissedConnectionWarning: false,
};
export const gameReducer = (state = initialState, action) => {
const { type, meta } = action;
if (type === 'roundrestart') {
return {
...state,
roundRestartedAt: meta.now,
};
}
if (type === connectionLost.type) {
return {
...state,
connectionLostAt: meta.now,
};
}
if (type === connectionRestored.type) {
return {
...state,
connectionLostAt: null,
dismissedConnectionWarning: false,
};
}
if (type === dismissWarning.type) {
return {
...state,
dismissedConnectionWarning: true,
};
}
return state;
};