A lot of work going on here. * Moved WorkspaceControls component to a new sub directory * Renamed overlay images * Started a static ChyronDriverBasic component (using Hamilton as an example) * Created a fancy DriverNumber rendering system * Defined DriverNumber style for Mercedes and no one else yet * A bunch of new states for the grid: cars, drivers, teams, etc * Defined a bunch of data for the drivers and teams * Created another string utility function to generate repeat strings; unit tests included
22 lines
696 B
TypeScript
22 lines
696 B
TypeScript
import { drivers, teams, teamNumberStyles, NumberStyle } from "../domain/data/teams";
|
|
import { Driver, DriverId, Team, TeamId } from "../types/state";
|
|
|
|
/**
|
|
* Prefer getting data from teams.ts through these simple getter functions.
|
|
* Why? Because we cannot use type literals (such as TeamId) as keys in an
|
|
* object in TypeScript. This allows me to enforce some type checking in a
|
|
* situation I wouldn't be able to normally
|
|
*/
|
|
|
|
export function getDriver(driverId: DriverId): Driver {
|
|
return drivers[driverId];
|
|
}
|
|
|
|
export function getTeam(teamId: TeamId): Team {
|
|
return teams[teamId];
|
|
}
|
|
|
|
export function getTeamNumberStyle(teamId: TeamId): NumberStyle {
|
|
return teamNumberStyles[teamId];
|
|
}
|