ISSUE-054 - Merged state.d.ts and state.ts for simplicity's sake.
Added new CarNotice and TyreCompound enums and data pieces.
This commit is contained in:
1 parent
2ad7fdd24c
commit
54878b8cb2
3 files changed
+458
-287
No files matched your search
@@ -1,8 +1,14 @@
|
|||||||
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
||||||
|
|
||||||
import { CourseFlag, CarStatus, RootState } from "../../types/state";
|
import { CourseFlag, CarStatus, RootState, Tyre, TyreCompound, CarNotice } from "../../types/state";
|
||||||
import { cloneDriver } from "../../utils/dataLookup";
|
import { cloneDriver } from "../../utils/dataLookup";
|
||||||
|
|
||||||
|
const DEFAULT_TYRE: Tyre = {
|
||||||
|
compound: TyreCompound.Medium,
|
||||||
|
age: 0,
|
||||||
|
new: true,
|
||||||
|
};
|
||||||
|
|
||||||
const initialState: RootState["event"] = {
|
const initialState: RootState["event"] = {
|
||||||
trackName: "Melbourne",
|
trackName: "Melbourne",
|
||||||
courseStatus: {
|
courseStatus: {
|
||||||
@@ -19,26 +25,166 @@ const initialState: RootState["event"] = {
|
|||||||
lapCount: 10,
|
lapCount: 10,
|
||||||
},
|
},
|
||||||
grid: [
|
grid: [
|
||||||
{ position: 1, status: CarStatus.Normal, distance: 2000 * 2, driver: cloneDriver("verstappen") },
|
{
|
||||||
{ position: 2, status: CarStatus.Normal, distance: 1900 * 2, driver: cloneDriver("hamilton") },
|
position: 1,
|
||||||
{ position: 3, status: CarStatus.Normal, distance: 1800 * 2, driver: cloneDriver("bottas") },
|
status: CarStatus.Normal,
|
||||||
{ position: 4, status: CarStatus.Retired, distance: 1700 * 2, driver: cloneDriver("perez") },
|
tyre: DEFAULT_TYRE,
|
||||||
{ position: 5, status: CarStatus.Normal, distance: 1600 * 2, driver: cloneDriver("sainz") },
|
notices: [],
|
||||||
{ position: 6, status: CarStatus.Retired, distance: 1500 * 2, driver: cloneDriver("norris") },
|
distance: 2000 * 2,
|
||||||
{ position: 7, status: CarStatus.Normal, distance: 1400 * 2, driver: cloneDriver("leclerc") },
|
driver: cloneDriver("verstappen"),
|
||||||
{ position: 8, status: CarStatus.Normal, distance: 1300 * 2, driver: cloneDriver("ricciardo") },
|
},
|
||||||
{ position: 9, status: CarStatus.Normal, distance: 1200 * 2, driver: cloneDriver("gasly") },
|
{
|
||||||
{ position: 10, status: CarStatus.Normal, distance: 1100 * 2, driver: cloneDriver("alonso") },
|
position: 2,
|
||||||
{ position: 11, status: CarStatus.Normal, distance: 1000 * 2, driver: cloneDriver("ocon") },
|
status: CarStatus.Normal,
|
||||||
{ position: 12, status: CarStatus.Normal, distance: 900 * 2, driver: cloneDriver("vettel") },
|
tyre: DEFAULT_TYRE,
|
||||||
{ position: 13, status: CarStatus.Normal, distance: 800 * 2, driver: cloneDriver("stroll") },
|
notices: [CarNotice.FastestLap],
|
||||||
{ position: 14, status: CarStatus.Normal, distance: 700 * 2, driver: cloneDriver("tsunoda") },
|
distance: 1900 * 2,
|
||||||
{ position: 15, status: CarStatus.Normal, distance: 600 * 2, driver: cloneDriver("russell") },
|
driver: cloneDriver("hamilton"),
|
||||||
{ position: 16, status: CarStatus.Normal, distance: 500 * 2, driver: cloneDriver("raikkonen") },
|
},
|
||||||
{ position: 17, status: CarStatus.Normal, distance: 400 * 2, driver: cloneDriver("latifi") },
|
{
|
||||||
{ position: 18, status: CarStatus.Normal, distance: 300 * 2, driver: cloneDriver("giovinazzi") },
|
position: 3,
|
||||||
{ position: 19, status: CarStatus.Normal, distance: 200 * 2, driver: cloneDriver("schumacher") },
|
status: CarStatus.Normal,
|
||||||
{ position: 20, status: CarStatus.Normal, distance: 1, driver: cloneDriver("mazepin") },
|
tyre: DEFAULT_TYRE,
|
||||||
|
notices: [],
|
||||||
|
distance: 1800 * 2,
|
||||||
|
driver: cloneDriver("bottas"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
position: 4,
|
||||||
|
status: CarStatus.Retired,
|
||||||
|
tyre: DEFAULT_TYRE,
|
||||||
|
notices: [],
|
||||||
|
distance: 1700 * 2,
|
||||||
|
driver: cloneDriver("perez"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
position: 5,
|
||||||
|
status: CarStatus.Normal,
|
||||||
|
tyre: DEFAULT_TYRE,
|
||||||
|
notices: [],
|
||||||
|
distance: 1600 * 2,
|
||||||
|
driver: cloneDriver("sainz"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
position: 6,
|
||||||
|
status: CarStatus.Retired,
|
||||||
|
tyre: DEFAULT_TYRE,
|
||||||
|
notices: [],
|
||||||
|
distance: 1500 * 2,
|
||||||
|
driver: cloneDriver("norris"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
position: 7,
|
||||||
|
status: CarStatus.Normal,
|
||||||
|
tyre: DEFAULT_TYRE,
|
||||||
|
notices: [],
|
||||||
|
distance: 1400 * 2,
|
||||||
|
driver: cloneDriver("leclerc"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
position: 8,
|
||||||
|
status: CarStatus.Normal,
|
||||||
|
tyre: DEFAULT_TYRE,
|
||||||
|
notices: [],
|
||||||
|
distance: 1300 * 2,
|
||||||
|
driver: cloneDriver("ricciardo"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
position: 9,
|
||||||
|
status: CarStatus.Normal,
|
||||||
|
tyre: DEFAULT_TYRE,
|
||||||
|
notices: [],
|
||||||
|
distance: 1200 * 2,
|
||||||
|
driver: cloneDriver("gasly"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
position: 10,
|
||||||
|
status: CarStatus.Normal,
|
||||||
|
tyre: DEFAULT_TYRE,
|
||||||
|
notices: [],
|
||||||
|
distance: 1100 * 2,
|
||||||
|
driver: cloneDriver("alonso"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
position: 11,
|
||||||
|
status: CarStatus.Normal,
|
||||||
|
tyre: DEFAULT_TYRE,
|
||||||
|
notices: [],
|
||||||
|
distance: 1000 * 2,
|
||||||
|
driver: cloneDriver("ocon"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
position: 12,
|
||||||
|
status: CarStatus.Normal,
|
||||||
|
tyre: DEFAULT_TYRE,
|
||||||
|
notices: [],
|
||||||
|
distance: 900 * 2,
|
||||||
|
driver: cloneDriver("vettel"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
position: 13,
|
||||||
|
status: CarStatus.Normal,
|
||||||
|
tyre: DEFAULT_TYRE,
|
||||||
|
notices: [],
|
||||||
|
distance: 800 * 2,
|
||||||
|
driver: cloneDriver("stroll"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
position: 14,
|
||||||
|
status: CarStatus.Normal,
|
||||||
|
tyre: DEFAULT_TYRE,
|
||||||
|
notices: [],
|
||||||
|
distance: 700 * 2,
|
||||||
|
driver: cloneDriver("tsunoda"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
position: 15,
|
||||||
|
status: CarStatus.Normal,
|
||||||
|
tyre: DEFAULT_TYRE,
|
||||||
|
notices: [],
|
||||||
|
distance: 600 * 2,
|
||||||
|
driver: cloneDriver("russell"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
position: 16,
|
||||||
|
status: CarStatus.Normal,
|
||||||
|
tyre: DEFAULT_TYRE,
|
||||||
|
notices: [],
|
||||||
|
distance: 500 * 2,
|
||||||
|
driver: cloneDriver("raikkonen"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
position: 17,
|
||||||
|
status: CarStatus.Normal,
|
||||||
|
tyre: DEFAULT_TYRE,
|
||||||
|
notices: [],
|
||||||
|
distance: 400 * 2,
|
||||||
|
driver: cloneDriver("latifi"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
position: 18,
|
||||||
|
status: CarStatus.Normal,
|
||||||
|
tyre: DEFAULT_TYRE,
|
||||||
|
notices: [],
|
||||||
|
distance: 300 * 2,
|
||||||
|
driver: cloneDriver("giovinazzi"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
position: 19,
|
||||||
|
status: CarStatus.Normal,
|
||||||
|
tyre: DEFAULT_TYRE,
|
||||||
|
notices: [],
|
||||||
|
distance: 200 * 2,
|
||||||
|
driver: cloneDriver("schumacher"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
position: 20,
|
||||||
|
status: CarStatus.Normal,
|
||||||
|
tyre: DEFAULT_TYRE,
|
||||||
|
notices: [],
|
||||||
|
distance: 1,
|
||||||
|
driver: cloneDriver("mazepin"),
|
||||||
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Vendored
-263
@@ -1,263 +0,0 @@
|
|||||||
import { Meters, Milliseconds, Optional } from "./util";
|
|
||||||
import { Corner, Fraction } from "./style";
|
|
||||||
|
|
||||||
export interface RootState {
|
|
||||||
pageDimensions: PageDimensions;
|
|
||||||
workspace: Workspace;
|
|
||||||
overlayTool: OverlayTool;
|
|
||||||
event: Event,
|
|
||||||
broadcastDirector: BroadcastDirector;
|
|
||||||
broadcastGraphics: BroadcastGraphics;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Page Dimensions
|
|
||||||
export interface PageDimensions {
|
|
||||||
mainMenu: Dimensions;
|
|
||||||
app: Dimensions;
|
|
||||||
workspace: Dimensions;
|
|
||||||
}
|
|
||||||
export interface Dimensions { width: number; height: number; }
|
|
||||||
|
|
||||||
// Workspace
|
|
||||||
export interface Workspace {
|
|
||||||
workspaceId: WorkspaceId;
|
|
||||||
animatedBG: boolean;
|
|
||||||
darkBG: boolean;
|
|
||||||
debugDurationMultiplier: Fraction,
|
|
||||||
workspaceProperties: WorkspaceProperties;
|
|
||||||
prototypeState: PrototypeState;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type WorkspaceId = string;
|
|
||||||
export interface WorkspaceProperties {
|
|
||||||
name: string;
|
|
||||||
overlayIds: OverlayIds;
|
|
||||||
previewWindowDimensions: Dimensions;
|
|
||||||
}
|
|
||||||
export interface PrototypeState {
|
|
||||||
angledFlagCountry?: {
|
|
||||||
flagA: string;
|
|
||||||
flagB: string;
|
|
||||||
};
|
|
||||||
angledFlagTeam?: {
|
|
||||||
flagA: TeamId;
|
|
||||||
flagB: TeamId;
|
|
||||||
};
|
|
||||||
venetianTransition?: {
|
|
||||||
mode: string,
|
|
||||||
subMode: string,
|
|
||||||
showBG: boolean;
|
|
||||||
wipeStartingCorner: Corner,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Overlay Tool
|
|
||||||
export interface OverlayTool {
|
|
||||||
currentWorkspaceId: WorkspaceId;
|
|
||||||
overlayIds: OverlayIds;
|
|
||||||
currentOverlayId: OverlayId | null;
|
|
||||||
currentOverlayItem: OverlayItem | null;
|
|
||||||
visible: boolean;
|
|
||||||
}
|
|
||||||
export type OverlayId = string;
|
|
||||||
export type OverlayIds = OverlayId[];
|
|
||||||
export interface OverlayPosition { x: number; y: number; }
|
|
||||||
export interface OverlayItem {
|
|
||||||
position: OverlayPosition;
|
|
||||||
opacity: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Event State
|
|
||||||
export interface Event {
|
|
||||||
trackName: string;
|
|
||||||
courseStatus: CourseStatus;
|
|
||||||
mode: EventMode;
|
|
||||||
progress: EventProgress;
|
|
||||||
grid: Grid;
|
|
||||||
}
|
|
||||||
export interface EventProgress {
|
|
||||||
startTime: Milliseconds;
|
|
||||||
timeLimit: Milliseconds;
|
|
||||||
currentLap: number;
|
|
||||||
lapCount: number;
|
|
||||||
}
|
|
||||||
export type EventMode =
|
|
||||||
| "race"
|
|
||||||
| "sprint"
|
|
||||||
| "p1"
|
|
||||||
| "p2"
|
|
||||||
| "p3"
|
|
||||||
| "q1"
|
|
||||||
| "q2"
|
|
||||||
| "q3";
|
|
||||||
export interface CourseStatus {
|
|
||||||
courseFlag: CourseFlags;
|
|
||||||
sectorFlags: CourseFlag[];
|
|
||||||
safetyCar: SafetyCarStatus;
|
|
||||||
virtualSafetyCar: VirtualSafetyCarStatus;
|
|
||||||
}
|
|
||||||
export type CourseFlag =
|
|
||||||
| "green"
|
|
||||||
| "yellow"
|
|
||||||
| "doubleYellow"
|
|
||||||
| "chequered"
|
|
||||||
| "red"
|
|
||||||
| "white"
|
|
||||||
| "redYellow";
|
|
||||||
export type SafetyCarStatus = "clear" | "starting" | "out" | "ending";
|
|
||||||
export type VirtualSafetyCarStatus = "clear" | "out" | "ending";
|
|
||||||
export type Grid = Car[]; // Grid order does not change.
|
|
||||||
export interface Car {
|
|
||||||
position: number;
|
|
||||||
driver: Driver;
|
|
||||||
status: CarStatus;
|
|
||||||
// flags: ???, // blue, red, meatball, black/white, black
|
|
||||||
// notices: ???; // Penalties, warnings, investigations, blue flags, etc
|
|
||||||
distance: Meters;
|
|
||||||
}
|
|
||||||
export interface Driver {
|
|
||||||
id: DriverId;
|
|
||||||
firstName: string;
|
|
||||||
lastName: string;
|
|
||||||
number: number;
|
|
||||||
team: Team;
|
|
||||||
yellowTCam: boolean;
|
|
||||||
initials: string;
|
|
||||||
nationality: string; // ISO 3166-1 alpha-3 codes
|
|
||||||
}
|
|
||||||
export type DriverId =
|
|
||||||
| "albon"
|
|
||||||
| "alonso"
|
|
||||||
| "bottas"
|
|
||||||
| "gasly"
|
|
||||||
| "giovinazzi"
|
|
||||||
| "hamilton"
|
|
||||||
| "kubica"
|
|
||||||
| "latifi"
|
|
||||||
| "leclerc"
|
|
||||||
| "mazepin"
|
|
||||||
| "norris"
|
|
||||||
| "ocon"
|
|
||||||
| "perez"
|
|
||||||
| "raikkonen"
|
|
||||||
| "ricciardo"
|
|
||||||
| "russell"
|
|
||||||
| "sainz"
|
|
||||||
| "schumacher"
|
|
||||||
| "stroll"
|
|
||||||
| "tsunoda"
|
|
||||||
| "verstappen"
|
|
||||||
| "vettel"
|
|
||||||
| "zhou";
|
|
||||||
|
|
||||||
export interface Team {
|
|
||||||
id: TeamId;
|
|
||||||
shortName: TeamShortName;
|
|
||||||
fullName: TeamFullName;
|
|
||||||
nationality: string; // ISO 3166-1 alpha-3 codes
|
|
||||||
// logo: string;
|
|
||||||
}
|
|
||||||
export type TeamId =
|
|
||||||
| "alfaRomeo"
|
|
||||||
| "alphaTauri"
|
|
||||||
| "alpine"
|
|
||||||
| "astonMartin"
|
|
||||||
| "ferrari"
|
|
||||||
| "haas"
|
|
||||||
| "mclaren"
|
|
||||||
| "mercedes"
|
|
||||||
| "redBull"
|
|
||||||
| "williams";
|
|
||||||
export type TeamShortName =
|
|
||||||
| "Alfa Romeo"
|
|
||||||
| "AlphaTauri"
|
|
||||||
| "Alpine"
|
|
||||||
| "Aston Martin"
|
|
||||||
| "Ferrari"
|
|
||||||
| "Haas F1 Team"
|
|
||||||
| "McLaren"
|
|
||||||
| "Mercedes"
|
|
||||||
| "Red Bull Racing"
|
|
||||||
| "Williams";
|
|
||||||
export type TeamFullName =
|
|
||||||
| "Alfa Romeo F1 Team ORLEN"
|
|
||||||
| "Scuderia AlphaTauri"
|
|
||||||
| "Alpine F1 Team"
|
|
||||||
| "Aston Martin Cognizant Formula One Team"
|
|
||||||
| "Scuderia Ferrari"
|
|
||||||
| "Uralkali Haas F1 Team"
|
|
||||||
| "McLaren F1 Team"
|
|
||||||
| "Mercedes-AMG Petronas Formula One Team"
|
|
||||||
| "Red Bull Racing"
|
|
||||||
| "Williams Racing";
|
|
||||||
|
|
||||||
// Broadcast Director
|
|
||||||
export interface BroadcastDirector {
|
|
||||||
selectedCars: Car[];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Broadcast Graphics
|
|
||||||
export interface BGRelativePos {
|
|
||||||
top?: string;
|
|
||||||
right?: string;
|
|
||||||
bottom?: string;
|
|
||||||
left?: string;
|
|
||||||
}
|
|
||||||
export interface BGBaseState {
|
|
||||||
relativePos: BGRelativePos;
|
|
||||||
openState: OpenState;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* -1 closing, 0 closed, 1 open, 2... different states (for progressive anims)
|
|
||||||
*/
|
|
||||||
export type OpenState = number;
|
|
||||||
|
|
||||||
export interface BroadcastGraphics {
|
|
||||||
timingBoard: BGTimingBoard;
|
|
||||||
// indicators: BGIndicators
|
|
||||||
chyrons: Optional<BGChyrons>;
|
|
||||||
// gems: BGGems
|
|
||||||
// toasts: BGToasts;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Timing Board
|
|
||||||
export interface BGTimingBoard extends BGBaseState {
|
|
||||||
statusIndicator: BGStatusIndicator;
|
|
||||||
timingTower: BGTimingTower;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Status Indicator
|
|
||||||
export interface BGStatusIndicator {
|
|
||||||
mode: BGStatusIndicatorModes;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Timing Tower
|
|
||||||
export interface BGTimingTower {
|
|
||||||
open: OpenState;
|
|
||||||
mode: BGTimingTowerModes;
|
|
||||||
focusedCars: Car[],
|
|
||||||
focusedCarsMode: BGTimingTowerFocusedCarsMode,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Chyrons
|
|
||||||
export type BGChyronMode = string;
|
|
||||||
export type BGChyronSubMode = string;
|
|
||||||
export interface BGChyrons extends BGBaseState {
|
|
||||||
mode: BGChyronMode;
|
|
||||||
subMode: BGChyronSubMode;
|
|
||||||
driver?: {
|
|
||||||
primary: BGChyronDriver;
|
|
||||||
secondary: Optional<BGChyronDriver>;
|
|
||||||
}
|
|
||||||
// sponsorGem: BGSponsorGem;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface BGChyronDriver extends BGChyron {
|
|
||||||
car: Car;
|
|
||||||
flagMode: FlagMode;
|
|
||||||
showPosFlag: boolean;
|
|
||||||
showDriverNumber: boolean;
|
|
||||||
showPortrait: boolean;
|
|
||||||
}
|
|
||||||
export type FlagMode = "country" | "team" | "none";
|
|
||||||
+291
-3
@@ -1,8 +1,160 @@
|
|||||||
// To support enums https://stackoverflow.com/a/66939542
|
import { Meters, Milliseconds, Optional } from "./util";
|
||||||
export * from "./state.d";
|
import { Corner, Fraction } from "./style";
|
||||||
|
|
||||||
|
export interface RootState {
|
||||||
|
pageDimensions: PageDimensions;
|
||||||
|
workspace: Workspace;
|
||||||
|
overlayTool: OverlayTool;
|
||||||
|
event: Event,
|
||||||
|
broadcastDirector: BroadcastDirector;
|
||||||
|
broadcastGraphics: BroadcastGraphics;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Page Dimensions
|
||||||
|
export interface PageDimensions {
|
||||||
|
mainMenu: Dimensions;
|
||||||
|
app: Dimensions;
|
||||||
|
workspace: Dimensions;
|
||||||
|
}
|
||||||
|
export interface Dimensions { width: number; height: number; }
|
||||||
|
|
||||||
|
// Workspace
|
||||||
|
export interface Workspace {
|
||||||
|
workspaceId: WorkspaceId;
|
||||||
|
animatedBG: boolean;
|
||||||
|
darkBG: boolean;
|
||||||
|
debugDurationMultiplier: Fraction,
|
||||||
|
workspaceProperties: WorkspaceProperties;
|
||||||
|
prototypeState: PrototypeState;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type WorkspaceId = string;
|
||||||
|
export interface WorkspaceProperties {
|
||||||
|
name: string;
|
||||||
|
overlayIds: OverlayIds;
|
||||||
|
previewWindowDimensions: Dimensions;
|
||||||
|
}
|
||||||
|
export interface PrototypeState {
|
||||||
|
angledFlagCountry?: {
|
||||||
|
flagA: string;
|
||||||
|
flagB: string;
|
||||||
|
};
|
||||||
|
angledFlagTeam?: {
|
||||||
|
flagA: TeamId;
|
||||||
|
flagB: TeamId;
|
||||||
|
};
|
||||||
|
venetianTransition?: {
|
||||||
|
mode: string,
|
||||||
|
subMode: string,
|
||||||
|
showBG: boolean;
|
||||||
|
wipeStartingCorner: Corner,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Overlay Tool
|
||||||
|
export interface OverlayTool {
|
||||||
|
currentWorkspaceId: WorkspaceId;
|
||||||
|
overlayIds: OverlayIds;
|
||||||
|
currentOverlayId: OverlayId | null;
|
||||||
|
currentOverlayItem: OverlayItem | null;
|
||||||
|
visible: boolean;
|
||||||
|
}
|
||||||
|
export type OverlayId = string;
|
||||||
|
export type OverlayIds = OverlayId[];
|
||||||
|
export interface OverlayPosition { x: number; y: number; }
|
||||||
|
export interface OverlayItem {
|
||||||
|
position: OverlayPosition;
|
||||||
|
opacity: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Event State
|
||||||
|
export interface Event {
|
||||||
|
trackName: string;
|
||||||
|
courseStatus: CourseStatus;
|
||||||
|
mode: EventMode;
|
||||||
|
progress: EventProgress;
|
||||||
|
grid: Grid;
|
||||||
|
}
|
||||||
|
export interface EventProgress {
|
||||||
|
startTime: Milliseconds;
|
||||||
|
timeLimit: Milliseconds;
|
||||||
|
currentLap: number;
|
||||||
|
lapCount: number;
|
||||||
|
}
|
||||||
|
export type EventMode =
|
||||||
|
| "race"
|
||||||
|
| "sprint"
|
||||||
|
| "p1"
|
||||||
|
| "p2"
|
||||||
|
| "p3"
|
||||||
|
| "q1"
|
||||||
|
| "q2"
|
||||||
|
| "q3";
|
||||||
|
export interface CourseStatus {
|
||||||
|
courseFlag: CourseFlag;
|
||||||
|
sectorFlags: CourseFlag[];
|
||||||
|
safetyCar: SafetyCarStatus;
|
||||||
|
virtualSafetyCar: VirtualSafetyCarStatus;
|
||||||
|
}
|
||||||
|
export type CourseFlag =
|
||||||
|
| "green"
|
||||||
|
| "yellow"
|
||||||
|
| "doubleYellow"
|
||||||
|
| "chequered"
|
||||||
|
| "red"
|
||||||
|
| "white"
|
||||||
|
| "redYellow";
|
||||||
|
export type SafetyCarStatus = "clear" | "starting" | "out" | "ending";
|
||||||
|
export type VirtualSafetyCarStatus = "clear" | "out" | "ending";
|
||||||
|
export type Grid = Car[]; // Grid order does not change.
|
||||||
|
export interface Car {
|
||||||
|
position: number;
|
||||||
|
driver: Driver;
|
||||||
|
status: CarStatus;
|
||||||
|
tyre: Tyre;
|
||||||
|
// flags: ???, // blue, red, meatball, black/white, black
|
||||||
|
notices: CarNotice[];
|
||||||
|
distance: Meters;
|
||||||
|
}
|
||||||
|
export interface Driver {
|
||||||
|
id: DriverId;
|
||||||
|
firstName: string;
|
||||||
|
lastName: string;
|
||||||
|
number: number;
|
||||||
|
team: Team;
|
||||||
|
yellowTCam: boolean;
|
||||||
|
initials: string;
|
||||||
|
nationality: string; // ISO 3166-1 alpha-3 codes
|
||||||
|
}
|
||||||
|
export type DriverId =
|
||||||
|
| "albon"
|
||||||
|
| "alonso"
|
||||||
|
| "bottas"
|
||||||
|
| "gasly"
|
||||||
|
| "giovinazzi"
|
||||||
|
| "hamilton"
|
||||||
|
| "kubica"
|
||||||
|
| "latifi"
|
||||||
|
| "leclerc"
|
||||||
|
| "mazepin"
|
||||||
|
| "norris"
|
||||||
|
| "ocon"
|
||||||
|
| "perez"
|
||||||
|
| "raikkonen"
|
||||||
|
| "ricciardo"
|
||||||
|
| "russell"
|
||||||
|
| "sainz"
|
||||||
|
| "schumacher"
|
||||||
|
| "stroll"
|
||||||
|
| "tsunoda"
|
||||||
|
| "verstappen"
|
||||||
|
| "vettel"
|
||||||
|
| "zhou";
|
||||||
|
|
||||||
export enum CarStatus {
|
export enum CarStatus {
|
||||||
Normal,
|
Normal,
|
||||||
|
OnGrid,
|
||||||
|
Finished,
|
||||||
Retired,
|
Retired,
|
||||||
InPit,
|
InPit,
|
||||||
OutLap,
|
OutLap,
|
||||||
@@ -10,11 +162,125 @@ export enum CarStatus {
|
|||||||
DidNotStart,
|
DidNotStart,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum CarNotice {
|
||||||
|
FastestLap,
|
||||||
|
BlueFlag,
|
||||||
|
BlackAndWhiteFlag,
|
||||||
|
BlackFlag,
|
||||||
|
BlackWithOrangeCircleFlag,
|
||||||
|
UnderInvestigation,
|
||||||
|
PenaltyDriveThrough,
|
||||||
|
Penalty5Seconds,
|
||||||
|
Penalty10Seconds,
|
||||||
|
Penalty10SecondsStopGo,
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Tyre {
|
||||||
|
compound: TyreCompound,
|
||||||
|
age: number,
|
||||||
|
new: boolean,
|
||||||
|
}
|
||||||
|
export enum TyreCompound {
|
||||||
|
Soft,
|
||||||
|
Medium,
|
||||||
|
Hard,
|
||||||
|
Wet,
|
||||||
|
Intermediate,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export interface Team {
|
||||||
|
id: TeamId;
|
||||||
|
shortName: TeamShortName;
|
||||||
|
fullName: TeamFullName;
|
||||||
|
nationality: string; // ISO 3166-1 alpha-3 codes
|
||||||
|
// logo: string;
|
||||||
|
}
|
||||||
|
export type TeamId =
|
||||||
|
| "alfaRomeo"
|
||||||
|
| "alphaTauri"
|
||||||
|
| "alpine"
|
||||||
|
| "astonMartin"
|
||||||
|
| "ferrari"
|
||||||
|
| "haas"
|
||||||
|
| "mclaren"
|
||||||
|
| "mercedes"
|
||||||
|
| "redBull"
|
||||||
|
| "williams";
|
||||||
|
export type TeamShortName =
|
||||||
|
| "Alfa Romeo"
|
||||||
|
| "AlphaTauri"
|
||||||
|
| "Alpine"
|
||||||
|
| "Aston Martin"
|
||||||
|
| "Ferrari"
|
||||||
|
| "Haas F1 Team"
|
||||||
|
| "McLaren"
|
||||||
|
| "Mercedes"
|
||||||
|
| "Red Bull Racing"
|
||||||
|
| "Williams";
|
||||||
|
export type TeamFullName =
|
||||||
|
| "Alfa Romeo F1 Team ORLEN"
|
||||||
|
| "Scuderia AlphaTauri"
|
||||||
|
| "Alpine F1 Team"
|
||||||
|
| "Aston Martin Cognizant Formula One Team"
|
||||||
|
| "Scuderia Ferrari"
|
||||||
|
| "Uralkali Haas F1 Team"
|
||||||
|
| "McLaren F1 Team"
|
||||||
|
| "Mercedes-AMG Petronas Formula One Team"
|
||||||
|
| "Red Bull Racing"
|
||||||
|
| "Williams Racing";
|
||||||
|
|
||||||
|
// Broadcast Director
|
||||||
|
export interface BroadcastDirector {
|
||||||
|
selectedCars: Car[];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Broadcast Graphics
|
||||||
|
export interface BGRelativePos {
|
||||||
|
top?: string;
|
||||||
|
right?: string;
|
||||||
|
bottom?: string;
|
||||||
|
left?: string;
|
||||||
|
}
|
||||||
|
export interface BGBaseState {
|
||||||
|
relativePos: BGRelativePos;
|
||||||
|
openState: OpenState;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* -1 closing, 0 closed, 1 open, 2... different states (for progressive anims)
|
||||||
|
*/
|
||||||
|
export type OpenState = number;
|
||||||
|
|
||||||
|
export interface BroadcastGraphics {
|
||||||
|
timingBoard: BGTimingBoard;
|
||||||
|
// indicators: BGIndicators
|
||||||
|
chyrons: Optional<BGChyrons>;
|
||||||
|
// gems: BGGems
|
||||||
|
// toasts: BGToasts;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Timing Board
|
||||||
|
export interface BGTimingBoard extends BGBaseState {
|
||||||
|
statusIndicator: BGStatusIndicator;
|
||||||
|
timingTower: BGTimingTower;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Status Indicator
|
||||||
|
export interface BGStatusIndicator {
|
||||||
|
mode: BGStatusIndicatorModes;
|
||||||
|
}
|
||||||
export enum BGStatusIndicatorModes {
|
export enum BGStatusIndicatorModes {
|
||||||
NormalNarrow, // "LAP" above "##/##" lap count.
|
NormalNarrow, // "LAP" above "##/##" lap count.
|
||||||
NormalWide, // "LAP" to the left of "##/##" lap count.
|
NormalWide, // "LAP" to the left of "##/##" lap count.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Timing Tower
|
||||||
|
export interface BGTimingTower {
|
||||||
|
open: OpenState;
|
||||||
|
mode: BGTimingTowerModes;
|
||||||
|
focusedCars: Car[],
|
||||||
|
focusedCarsMode: BGTimingTowerFocusedCarsMode,
|
||||||
|
}
|
||||||
export enum BGTimingTowerModes {
|
export enum BGTimingTowerModes {
|
||||||
Hidden, // Not on display.
|
Hidden, // Not on display.
|
||||||
Minimum, // Just the driver name abbrv.
|
Minimum, // Just the driver name abbrv.
|
||||||
@@ -22,8 +288,30 @@ export enum BGTimingTowerModes {
|
|||||||
Interval, // Interval timing.
|
Interval, // Interval timing.
|
||||||
FullName, // Displays full name.
|
FullName, // Displays full name.
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum BGTimingTowerFocusedCarsMode {
|
export enum BGTimingTowerFocusedCarsMode {
|
||||||
None, // When no special treatments are made.
|
None, // When no special treatments are made.
|
||||||
Portrait, // When it shows the portrait of the driver.
|
Portrait, // When it shows the portrait of the driver.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Chyrons
|
||||||
|
export type BGChyronMode = string;
|
||||||
|
export type BGChyronSubMode = string;
|
||||||
|
export interface BGChyrons extends BGBaseState {
|
||||||
|
mode: BGChyronMode;
|
||||||
|
subMode: BGChyronSubMode;
|
||||||
|
driver?: {
|
||||||
|
primary: BGChyronDriver;
|
||||||
|
secondary: Optional<BGChyronDriver>;
|
||||||
|
}
|
||||||
|
// sponsorGem: BGSponsorGem;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BGChyronDriver {
|
||||||
|
car: Car;
|
||||||
|
flagMode: FlagMode;
|
||||||
|
showPosFlag: boolean;
|
||||||
|
showDriverNumber: boolean;
|
||||||
|
showPortrait: boolean;
|
||||||
|
}
|
||||||
|
export type FlagMode = "country" | "team" | "none";
|
||||||
Reference in new issue
Block a user