ISSUE-032 - Defined a great number of new state types for use with the race event's state, the broadcast director's controls, and the broadcast graphics states.

Taking a second to make a commit to save my progress so far.
This commit is contained in:
Kyle Geib committed 2022-01-27 13:39:52 -05:00
1 parent ef0b58e98b
commit 5d009a3d70
12 files changed
+254 -21

No files matched your search

+3
View File
@@ -0,0 +1,3 @@
import { RootState } from "../../types/state";
export const eventSelector = (state: RootState) => state.event;
+58
View File
@@ -0,0 +1,58 @@
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
import { CourseFlag, RootState } from "../../types/state";
import { getDriver } from "../../utils/dataLookup";
const initialState: RootState["event"] = {
trackName: "Melbourne",
courseStatus: {
courseFlag: "green",
sectorFlags: ["green", "green", "green"],
safetyCar: "clear",
virtualSafetyCar: "clear",
},
mode: "race",
progress: {
startTime: Date.now(),
timeLimit: 60 * 60 * 2 * 1000,
currentLap: 1,
lapCount: 10,
},
grid: [
{ position: 1, driver: getDriver("verstappen") },
{ position: 3, driver: getDriver("hamilton") },
{ position: 2, driver: getDriver("bottas") },
{ position: 4, driver: getDriver("perez") },
{ position: 5, driver: getDriver("sainz") },
{ position: 6, driver: getDriver("norris") },
{ position: 7, driver: getDriver("leclerc") },
{ position: 8, driver: getDriver("ricciardo") },
{ position: 9, driver: getDriver("gasly") },
{ position: 10, driver: getDriver("alonso") },
{ position: 11, driver: getDriver("ocon") },
{ position: 12, driver: getDriver("vettel") },
{ position: 13, driver: getDriver("stroll") },
{ position: 14, driver: getDriver("tsunoda") },
{ position: 15, driver: getDriver("russell") },
{ position: 16, driver: getDriver("raikkonen") },
{ position: 17, driver: getDriver("latifi") },
{ position: 18, driver: getDriver("giovinazzi") },
{ position: 19, driver: getDriver("schumacher") },
{ position: 20, driver: getDriver("mazepin") },
],
};
export const eventSlice = createSlice({
name: "event",
initialState,
reducers: {
courseFlagSet: (state, action: PayloadAction<CourseFlag>) => {
state.courseStatus.courseFlag = action.payload;
},
},
});
export const {
courseFlagSet,
} = eventSlice.actions;
export default eventSlice.reducer;