ISSUE-054 - Initial work of building the Timing Board. Working so far only have work for the Timing Tower.

Timing Board is the combination of all elements on the left side of the screen, including the Status Indicator component (not written yet) that is visible whenever there are cars on track.
This commit is contained in:
Kyle Geib committed 2022-02-16 14:36:27 -05:00
1 parent 8bf413ba31
commit 22ebab1101
19 files changed
+521 -41

No files matched your search

@@ -21,7 +21,6 @@ import {
LastName, LastName,
NameContainer, NameContainer,
NumberContainer, NumberContainer,
Spacer,
TeamColorBar, TeamColorBar,
TeamName, TeamName,
TextContainer, TextContainer,
@@ -29,6 +28,7 @@ import {
DriverPortraitContainer, DriverPortraitContainer,
} from "./styles"; } from "./styles";
import { VenetianBlindsTransition } from "../../Common/VenetianBlindsTransition"; import { VenetianBlindsTransition } from "../../Common/VenetianBlindsTransition";
import { Spacer } from "../../Common/Spacer.styled";
type ChyronDriverProps = { type ChyronDriverProps = {
chyronData: BGChyronDriver, chyronData: BGChyronDriver,
@@ -171,16 +171,6 @@ export const TeamName = styled.div<TeamNameProps>`
`; `;
TeamName.displayName = "TeamName"; TeamName.displayName = "TeamName";
type SpacerProps = {
width?: string,
height?: string;
};
export const Spacer = styled.div<SpacerProps>`
width: ${({ width = "0" }) => width};
height: ${({ height = "0" }) => height};
`;
Spacer.displayName = "Spacer";
type FlagContainerProps = { type FlagContainerProps = {
height: Px, height: Px,
width: Px, width: Px,
@@ -0,0 +1,11 @@
import styled from "styled-components";
type SpacerProps = {
width?: string,
height?: string;
};
export const Spacer = styled.div<SpacerProps>`
width: ${({ width = "0" }) => width};
height: ${({ height = "0" }) => height};
`;
Spacer.displayName = "Spacer";
@@ -0,0 +1,101 @@
import { useSelector } from "react-redux";
import { broadcastGraphicsSelector } from "../../../../features/broadcast/graphics/broadcastGraphicsSelector";
import { eventSelector } from "../../../../features/event/eventSelector";
import { BGTimingTowerModes, Car, CarStatus } from "../../../../types/state";
import { orMatch } from "../../../../utils/common";
import { PositionFlag } from "../../Common/PositionFlag";
import { Spacer } from "../../Common/Spacer.styled";
import {
DriverName,
RowContainer,
RowLeftHalf,
RowLeftHalfLayout,
RowRightHalf,
RowRightHalfLayout,
RowsContainer,
} from "./styles";
type TimingTowerProps = {
carsToDisplay?: number,
}
export function TimingTower({
carsToDisplay = 20,
}: TimingTowerProps) {
const { grid } = useSelector(eventSelector);
const { timingBoard } = useSelector(broadcastGraphicsSelector);
const runningCars: Car[] = [];
const retiredCars: Car[] = [];
grid.forEach((car, index) => {
if (index >= carsToDisplay) return;
if (car.status === CarStatus.Retired) {
retiredCars.push(car);
} else {
runningCars.push(car);
}
});
const buildRow = (
car: Car,
index: number,
count: number,
) => {
const lastRow = index + 1 === count;
return (
<RowContainer
key={car.driver.id}
topGap={car.status === CarStatus.Retired && index === 0}
retired={car.status === CarStatus.Retired}
wide={timingBoard.timingTower.mode !== BGTimingTowerModes.Minimum}
>
<RowLeftHalf
roundedCorner={lastRow && orMatch(
timingBoard.timingTower.mode,
BGTimingTowerModes.Minimum,
BGTimingTowerModes.FullName,
)}
>
<RowLeftHalfLayout>
<Spacer width="3px" />
{car.status !== CarStatus.Retired && (
<PositionFlag
size={32}
number={index + 1} // Not using car.position...
/>
)}
<Spacer width="14px" />
<DriverName>
{car.driver.initials}
</DriverName>
</RowLeftHalfLayout>
</RowLeftHalf>
<RowRightHalf
roundedCorner={lastRow && orMatch(
timingBoard.timingTower.mode,
BGTimingTowerModes.Leader,
BGTimingTowerModes.Interval,
)}
>
<RowRightHalfLayout>
</RowRightHalfLayout>
</RowRightHalf>
</RowContainer>
);
};
const rows = runningCars.map((car, index, cars) => buildRow(car, index, cars.length));
rows.push(...retiredCars.map((car, index, cars) => buildRow(car, index, cars.length)));
return (
<RowsContainer>
{rows}
</RowsContainer>
);
}
@@ -0,0 +1 @@
export * from "./TimingTower";
@@ -0,0 +1,86 @@
import styled, { css } from "styled-components";
export const RowsContainer = styled.div`
display: flex;
flex-direction: column;
flex-wrap: nowrap;
justify-content: flex-start;
align-items: stretch;
`;
type RowContainerProps = {
topGap?: boolean,
bottomGap?: boolean,
retired?: boolean,
wide?: boolean,
}
// All the elements in a row should go in here.
export const RowContainer = styled.div<RowContainerProps>`
position: relative;
width: ${({ wide }) => wide ? 255 : 147}px;
height: 36px; // Future will be animated.
${({ topGap }) => topGap && css`margin-top: 3px;`}
${({ bottomGap }) => bottomGap && css`margin-bottom: 3px;`}
${({ retired }) => retired && css`opacity: 0.4;`}
`;
type RoundedProp = {
roundedCorner?: boolean;
};
const Rounded = styled.div<RoundedProp>`
${({ roundedCorner }) => roundedCorner && css`border-bottom-right-radius: 5px;`}
`;
export const RowLeftHalf = styled(Rounded)`
position: absolute;
left: 0;
top: 0;
width: 147px; // Future will be animated.
height: 36px;
background-color: #000000cb
`;
export const RowLeftHalfLayout = styled.div`
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: flex-start;
`;
export const RowRightHalf = styled(Rounded)`
position: absolute;
right: 0;
top: 0;
width: 108px; // Future will be animated.
height: 36px;
overflow-x: hidden;
background-color: #0000007e
`;
export const RowRightHalfLayout = styled.div`
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: flex-end;
`;
export const DriverName = styled.span`
color: white;
font-family: ${p => p.theme.fonts.f1Bold};
font-size: 20px;
`;
@@ -18,6 +18,7 @@ import { AngledFlagPrototypeControls } from "./PrototypingControls/AngledFlagPro
import { ChyronContainer } from "../BroadcastGraphics/Chyrons/Container"; import { ChyronContainer } from "../BroadcastGraphics/Chyrons/Container";
import { VenetianBlindsWorkspace } from "./CustomWorkSpaces/VenetianBlindsWorkspace"; import { VenetianBlindsWorkspace } from "./CustomWorkSpaces/VenetianBlindsWorkspace";
import { VenetianBlindsPrototypeControls } from "./PrototypingControls/VenetianBlindsPrototype"; import { VenetianBlindsPrototypeControls } from "./PrototypingControls/VenetianBlindsPrototype";
import { TimingTower } from "../BroadcastGraphics/TimingBoard/TimingTower";
const WORKSPACE_LIST_WIDTH = 180; const WORKSPACE_LIST_WIDTH = 180;
@@ -89,6 +90,20 @@ export default function Workspaces() {
prototypeControls={<VenetianBlindsPrototypeControls />} prototypeControls={<VenetianBlindsPrototypeControls />}
/> />
} /> } />
<Route path="timingBoardFull" element={
<Workspace
workspaceId="timingBoardFull"
previewContent={<TimingTower />}
prototypeControls={<div>Timing Tower Full</div>}
/>
} />
<Route path="timingBoardShort" element={
<Workspace
workspaceId="timingBoardShort"
previewContent={<TimingTower carsToDisplay={6} />}
prototypeControls={<div>Timing Tower Short</div>}
/>
} />
<Route path="*" element={<IndexHeading>Unknown Workspace</IndexHeading>} /> <Route path="*" element={<IndexHeading>Unknown Workspace</IndexHeading>} />
</Routes> </Routes>
</FullScreenContainer> </FullScreenContainer>
+22
View File
@@ -84,4 +84,26 @@ export const workspaces: WorkspaceObject = {
height: 500, height: 500,
}, },
}, },
timingBoardFull: {
name: "Timing Board (Full)",
overlayIds: [
"timing-board-leader-19.png",
"timing-board-leader-20-out-1.png",
"timing-board-intervals-yellow-flag.png",
],
previewWindowDimensions: {
width: 350,
height: 820,
},
},
timingBoardShort: {
name: "Timing Board (Short)",
overlayIds: [
"timing-board-portrait-gap.png",
],
previewWindowDimensions: {
width: 350,
height: 410,
},
},
}; };
@@ -1,9 +1,29 @@
import { createSlice, PayloadAction } from "@reduxjs/toolkit"; import { createSlice, PayloadAction } from "@reduxjs/toolkit";
import { BGChyrons, OpenState, RootState } from "../../../types/state"; import {
BGChyrons,
BGStatusIndicatorModes,
BGTimingTowerFocusedCarsMode,
BGTimingTowerModes,
OpenState,
RootState,
} from "../../../types/state";
const initialState: RootState["broadcastGraphics"] = { const initialState: RootState["broadcastGraphics"] = {
chyrons: null, chyrons: null,
timingBoard: {
relativePos: {},
openState: 0,
statusIndicator: {
mode: BGStatusIndicatorModes.NormalNarrow,
},
timingTower: {
open: 1,
mode: BGTimingTowerModes.Leader,
focusedCars: [],
focusedCarsMode: BGTimingTowerFocusedCarsMode.None,
},
},
}; };
export const broadcastGraphicsSlice = createSlice({ export const broadcastGraphicsSlice = createSlice({
+21 -21
View File
@@ -1,6 +1,6 @@
import { createSlice, PayloadAction } from "@reduxjs/toolkit"; import { createSlice, PayloadAction } from "@reduxjs/toolkit";
import { CourseFlag, RootState } from "../../types/state"; import { CourseFlag, CarStatus, RootState } from "../../types/state";
import { cloneDriver } from "../../utils/dataLookup"; import { cloneDriver } from "../../utils/dataLookup";
const initialState: RootState["event"] = { const initialState: RootState["event"] = {
@@ -19,26 +19,26 @@ const initialState: RootState["event"] = {
lapCount: 10, lapCount: 10,
}, },
grid: [ grid: [
{ position: 1, driver: cloneDriver("verstappen") }, { position: 1, status: CarStatus.Normal, driver: cloneDriver("verstappen") },
{ position: 2, driver: cloneDriver("hamilton") }, { position: 2, status: CarStatus.Normal, driver: cloneDriver("hamilton") },
{ position: 3, driver: cloneDriver("bottas") }, { position: 3, status: CarStatus.Normal, driver: cloneDriver("bottas") },
{ position: 4, driver: cloneDriver("perez") }, { position: 4, status: CarStatus.Retired, driver: cloneDriver("perez") },
{ position: 5, driver: cloneDriver("sainz") }, { position: 5, status: CarStatus.Normal, driver: cloneDriver("sainz") },
{ position: 6, driver: cloneDriver("norris") }, { position: 6, status: CarStatus.Retired, driver: cloneDriver("norris") },
{ position: 7, driver: cloneDriver("leclerc") }, { position: 7, status: CarStatus.Normal, driver: cloneDriver("leclerc") },
{ position: 8, driver: cloneDriver("ricciardo") }, { position: 8, status: CarStatus.Normal, driver: cloneDriver("ricciardo") },
{ position: 9, driver: cloneDriver("gasly") }, { position: 9, status: CarStatus.Normal, driver: cloneDriver("gasly") },
{ position: 10, driver: cloneDriver("alonso") }, { position: 10, status: CarStatus.Normal, driver: cloneDriver("alonso") },
{ position: 11, driver: cloneDriver("ocon") }, { position: 11, status: CarStatus.Normal, driver: cloneDriver("ocon") },
{ position: 12, driver: cloneDriver("vettel") }, { position: 12, status: CarStatus.Normal, driver: cloneDriver("vettel") },
{ position: 13, driver: cloneDriver("stroll") }, { position: 13, status: CarStatus.Normal, driver: cloneDriver("stroll") },
{ position: 14, driver: cloneDriver("tsunoda") }, { position: 14, status: CarStatus.Normal, driver: cloneDriver("tsunoda") },
{ position: 15, driver: cloneDriver("russell") }, { position: 15, status: CarStatus.Normal, driver: cloneDriver("russell") },
{ position: 16, driver: cloneDriver("raikkonen") }, { position: 16, status: CarStatus.Normal, driver: cloneDriver("raikkonen") },
{ position: 17, driver: cloneDriver("latifi") }, { position: 17, status: CarStatus.Normal, driver: cloneDriver("latifi") },
{ position: 18, driver: cloneDriver("giovinazzi") }, { position: 18, status: CarStatus.Normal, driver: cloneDriver("giovinazzi") },
{ position: 19, driver: cloneDriver("schumacher") }, { position: 19, status: CarStatus.Normal, driver: cloneDriver("schumacher") },
{ position: 20, driver: cloneDriver("mazepin") }, { position: 20, status: CarStatus.Normal, driver: cloneDriver("mazepin") },
], ],
}; };
+1 -1
View File
@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:vectornator="http://vectornator.io" viewBox="0 0 510.3 510.3" clip-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"><defs><linearGradient y1="-.036" id="prefix__a" x1="222.792" y2="-20.972" x2="243.728" gradientUnits="userSpaceOnUse" gradientTransform="matrix(4.11037 0 0 -4.11037 -703.579 188.953)"><stop stop-color="#396" offset="0"/><stop stop-color="#004f32" offset="1"/><stop stop-color="#004f32" offset="1"/></linearGradient></defs><g vectornator:layerName="Layer 1"><path d="M255.22 291.823c-.93 0-1.614.696-1.622.712-.04.033-16.515 15.753-16.515 15.753-6.075 5.864-14.14 3.41-15.002 3.123 0 0-70.419-19.209-70.429-19.216-13.438-4.054-16.108-8.427-18.165-13.738 0 0-1.195-3.302-4.119-4.167 0 0-86.082-25.271-86.09-25.271-3.513-1.084-5.446-2.075-6.827-4.75 0 0-4.725-8.319-4.74-8.343-1.048-1.994-2.947-2.205-3.057-2.221-6.51-.879-8.419-4.509-9.226-6.054l-3.84-6.744c-1.201-2.09-2.918-2.267-2.972-2.273-3.702-.234-5.463-1.168-6.994-3.682 0 0-3.754-6.243-3.77-6.275-1.845-3.409-1.207-5.849-.356-7.298 1.795-2.97 5.077-3.195 6.394-3.242h205.837c5.828 0 10.537 1.766 14.019 5.258 2.501 2.492 4.223 5.744 5.114 9.66.016.092.258.91 2.02.91h40.684c1.763 0 2.004-.816 2.019-.91.892-3.916 2.614-7.168 5.115-9.66 3.481-3.492 8.189-5.258 14.02-5.258h205.837c1.317.045 4.597.272 6.391 3.241.853 1.448 1.489 3.888-.356 7.298-.016.031-3.77 6.275-3.77 6.275-1.531 2.513-3.291 3.447-6.994 3.682-.052.006-1.772.183-2.972 2.272l-3.84 6.744c-.807 1.546-2.715 5.176-9.225 6.055-.109.016-2.008.227-3.058 2.221-.015.023-4.739 8.343-4.739 8.343-1.381 2.674-3.314 3.667-6.825 4.75-.006 0-86.09 25.27-86.09 25.27-2.924.865-4.119 4.167-4.119 4.167-2.055 5.312-4.725 9.685-18.165 13.739-.008.006-70.429 19.216-70.429 19.216-.861.286-8.927 2.74-15.002-3.124 0 0-16.473-15.722-16.517-15.753-.006-.016-.689-.712-1.62-.712h-.005v.002z"/><path d="M281.323 213.89c.721-3.189 2.097-5.804 4.074-7.782 2.737-2.742 6.551-4.137 11.312-4.137h94.558c-3.25 2.432-4.956 5.508-5.07 5.713a154.197 154.197 0 01-4.09 7.143H280.99c.209-.367.334-.937.333-.937zm223.896-7.047l-3.691 6.139c-.69 1.138-1.117 1.653-3.954 1.833l-111.984.015a160.626 160.626 0 003.228-5.721c.031-.058 3.998-7.127 11.041-7.127l102.587-.01c1.076.045 2.474.166 3.214 1.387.089.165.3.506.3 1.12 0 .545-.173 1.319-.741 2.364zm-13.695 12.17l-3.91 6.864c-.534 1.015-1.356 2.584-3.968 3.487-2.184.545-6.529.198-8.033.015l-95.25-6.328a172.443 172.443 0 003.412-5.249h108.572a9.578 9.578 0 00-.823 1.211zm-16.193 15.123c.025-.03-3.746 6.609-4.529 7.987-.193.258-1.266 1.424-4.754.961l-91.272-12.244a165.471 165.471 0 003.549-4.828l96.956 6.433c.142.017.551.062 1.134.114a8.117 8.117 0 00-1.084 1.577zm-31.391 17.716c-3.436.91-10.157-.121-12.49-.606l-62.718-12.891a167.207 167.207 0 003.94-4.793l91.661 12.303-20.393 5.987zm-31.089 9.123c-4.41 1.181-10.166-.729-10.221-.745l-.069-.021s-.007-.008-.015-.008l-41.978-12.949a165.125 165.125 0 005.92-6.319l64.361 13.229c.141.022 1.459.294 3.31.554l-21.308 6.259zm-32.792 9.631c-2.979.811-7.373-.91-8.83-1.645 0 0-11.234-5.258-22.769-10.654a153.32 153.32 0 009.715-8.675l43.532 13.434c.085.031.876.289 2.089.562l-23.737 6.978zm-6.719 6.57c-1.268 3.25-2.593 6.598-11.522 9.953-3.687 1.145-8.071-2.114-8.109-2.15-.015-.016-9.956-7.131-21.277-15.231a147.183 147.183 0 0013.438-9.372l24.054 11.26c.133.067 2.614 1.32 5.618 1.88-1.436 1.636-2.086 3.326-2.202 3.66zm-33.646 16.261l-3.352.909c-2.823.676-6.267-2.121-7.368-3.283 0 0-5.41-5.629-12.363-12.888a140.233 140.233 0 0013.035-6.751l22.294 15.951c.091.075 1.364 1.029 3.235 1.841a26228.92 26228.92 0 00-15.481 4.221zm-29.475 8.039c-2.354.371-5.085-3.492-5.876-4.933l-6.724-11.38a138.062 138.062 0 0016.08-5.713l13.115 13.685c.115.114 1.567 1.621 3.672 2.811l-20.267 5.53zm-22.321 6.083c-1.584.365-2.921.205-4.071-.489-2.467-1.51-3.288-4.98-3.333-5.184l-3.43-12.375a148.085 148.085 0 0017.58-3.522l7.113 12.042c.244.43 1.688 2.947 3.851 4.705l-17.71 4.823zm-14.466-4.49s-9.537-9.102-12.772-12.18c4.539-.158 9.018-.491 13.417-1.007l3.506 12.653c.1.44.801 3.214 2.748 5.42-2.687-.765-3.502-1.561-6.899-4.886zm-16.72-15.075v-38.551h6.153l10.405 37.538c-5.415.621-10.933.962-16.558 1.013zm-19.544-1.013l10.41-37.538h6.155v38.547a158.517 158.517 0 01-16.565-1.009zm-2.733 18.534a9.754 9.754 0 01-4.331 2.441c1.962-2.213 2.644-4.994 2.747-5.425l3.508-12.632c4.398.507 8.878.84 13.415.992-3.633 3.453-15.339 14.624-15.339 14.624zm-4.492-3.652c0 .037-.808 3.66-3.339 5.207-1.148.694-2.481.855-4.065.489l-17.711-4.825c2.163-1.767 3.622-4.282 3.872-4.744-.008.008 3-5.077 7.081-11.995a146.225 146.225 0 0017.591 3.515l-3.429 12.353zm-29.726-.387l-20.266-5.532c2.102-1.196 3.56-2.704 3.671-2.817 0 0 5.793-6.049 13.113-13.679a139.106 139.106 0 0016.076 5.721l-6.696 11.345c-.815 1.468-3.546 5.333-5.898 4.962zm-26.128-7.13l-18.83-5.13a16.711 16.711 0 003.266-1.865c-.016.016 10.52-7.524 22.263-15.925a141.832 141.832 0 0013.043 6.749l-12.371 12.888c-1.099 1.162-4.545 3.959-7.371 3.283zm-25.493-7.215c-8.893-3.357-10.226-6.696-11.489Line truncated <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 510.3 510.3" xmlns:vectornator="http://vectornator.io" clip-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"><defs><linearGradient x1="222.792" y1="-.036" gradientTransform="matrix(4.11037 0 0 -4.11037 -703.579 188.953)" id="prefix__a" y2="-20.972" x2="243.728" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#396"/><stop offset="1" stop-color="#004f32"/><stop stop-color="#004f32" offset="1"/></linearGradient></defs><g vectornator:layerName="Layer 1" fill-rule="evenodd"><path d="M255.22 291.823c-.93 0-1.614.696-1.622.712-.04.033-16.515 15.753-16.515 15.753-6.075 5.864-14.14 3.41-15.002 3.123 0 0-70.419-19.209-70.429-19.216-13.438-4.054-16.108-8.427-18.165-13.738 0 0-1.195-3.302-4.119-4.167 0 0-86.082-25.271-86.09-25.271-3.513-1.084-5.446-2.075-6.827-4.75 0 0-4.725-8.319-4.74-8.343-1.048-1.994-2.947-2.205-3.057-2.221-6.51-.879-8.419-4.509-9.226-6.054l-3.84-6.744c-1.201-2.09-2.918-2.267-2.972-2.273-3.702-.234-5.463-1.168-6.994-3.682 0 0-3.754-6.243-3.77-6.275-1.845-3.409-1.207-5.849-.356-7.298 1.795-2.97 5.077-3.195 6.394-3.242h205.837c5.828 0 10.537 1.766 14.019 5.258 2.501 2.492 4.223 5.744 5.114 9.66.016.092.258.91 2.02.91h40.684c1.763 0 2.004-.816 2.019-.91.892-3.916 2.614-7.168 5.115-9.66 3.481-3.492 8.189-5.258 14.02-5.258h205.837c1.317.045 4.597.272 6.391 3.241.853 1.448 1.489 3.888-.356 7.298-.016.031-3.77 6.275-3.77 6.275-1.531 2.513-3.291 3.447-6.994 3.682-.052.006-1.772.183-2.972 2.272l-3.84 6.744c-.807 1.546-2.715 5.176-9.225 6.055-.109.016-2.008.227-3.058 2.221-.015.023-4.739 8.343-4.739 8.343-1.381 2.674-3.314 3.667-6.825 4.75-.006 0-86.09 25.27-86.09 25.27-2.924.865-4.119 4.167-4.119 4.167-2.055 5.312-4.725 9.685-18.165 13.739-.008.006-70.429 19.216-70.429 19.216-.861.286-8.927 2.74-15.002-3.124 0 0-16.473-15.722-16.517-15.753-.006-.016-.689-.712-1.62-.712h-.005v.002z"/><path fill="url(#prefix__a)" d="M153.29 246.465l-.044-.045v-28.605h203.931v28.619c-.006.015-.016.015-.022.023l-203.865.008z"/><path d="M166.796 222.383h-.851l-8.715 19.496h2.36l.038-.112c.705-2.373 1.614-4.646 2.496-6.826l.183-.463h6.739a102.476 102.476 0 012.842 7.295l.039.106h3.258l-8.389-19.496zm-3.829 10.608c.178-.43 2.465-5.789 2.737-6.424.269.635 2.601 5.994 2.784 6.424h-5.521zm13.157 7.501l.072.075c1.029 1.123 3.35 1.647 4.598 1.647 4.089 0 6.952-2.639 6.952-6.424 0-3.139-2.375-4.063-4.671-4.972-2.04-.812-3.979-1.561-3.979-3.879 0-1.759 1.387-3.031 3.289-3.031 1.52 0 2.668.803 3.25 2.271l.039.105h.519l.815-2.46-.091-.085c-1.11-1.001-2.82-1.356-4.036-1.356-3.812 0-6.271 2.129-6.271 5.434 0 3.364 2.509 4.34 4.717 5.221 1.998.772 3.872 1.515 3.872 3.827 0 2.144-1.599 3.833-3.635 3.833-1.866 0-3.103-.804-4.309-2.773l-.047-.075h-.52l-.564 2.642zm27.01-17.707h-14.337v2.008l.185-.015a51.352 51.352 0 015.828-.335v17.497h2.754v-17.488c1.947 0 3.807.112 5.546.326l.194.022v-2.015h-.17zm9.877-.402c-6.081 0-10.336 4.1-10.336 9.957 0 5.909 4.137 9.872 10.283 9.872 6.353 0 10.629-4.138 10.629-10.29.002-6.592-5.315-9.539-10.576-9.539zm5.091 16.428c-1.353 1.431-3.05 2.16-5.069 2.16-4.452 0-7.331-3.257-7.331-8.296 0-5.584 2.909-9.048 7.581-9.048 2.204 0 4.284.969 5.57 2.59 1.412 1.803 1.7 3.683 1.7 5.934.008.122.015.258.015.388 0 1.831-.746 4.431-2.466 6.272zm24.581-16.026h-1.708v14.132h-.032c-.098-.115-13.044-14.132-13.044-14.132h-1.317v19.094h1.879v-14.775h.039c.1.114 11.799 13.064 11.799 13.064l1.467 1.713h1.087v-19.096h-.17zm30.852 0h-.675l-4.625 8.387s-2.927 5.335-3.192 5.813c-2.853-4.759-5.423-9.767-7.61-14.109l-.045-.091h-.971l-.016.16c-.272 2.82-1.914 14.312-2.632 18.745l-.038.189h2.315v-.164c0-2.69.477-6.7.984-10.952l.305-2.629c.324.62 3.916 7.442 5.288 10.253l1.553 3.198h.519l.044-.106c1.597-3.669 3.852-7.858 6.938-13.374.437 3.289 1.015 9.858 1.336 13.623l.017.153h2.925l-.025-.189c-.66-4.632-1.381-10.761-2.224-18.746l-.017-.159h-.154v-.002zm13.095-.402h-.857l-8.718 19.496h2.374l.031-.112c.709-2.395 1.622-4.675 2.509-6.874 0 0 .109-.273.163-.416h6.744a103.37 103.37 0 012.837 7.294l.038.107h3.261l-8.382-19.495zm-3.834 10.608c.179-.43 2.467-5.789 2.74-6.424l2.785 6.424h-5.525zm20.601-.545c3.445-.696 5.507-2.659 5.507-5.311 0-2.916-2.048-4.348-6.266-4.348h-5.984v19.094h2.748v-9.153h.802c.711.842 1.424 1.683 2.138 2.523-.009-.01 3.237 4.19 3.237 4.19l1.776 2.44h3.599c0-.002-7.23-9.033-7.557-9.435zm-3.995-1.09v-7.213c1.132-.053 2.889-.128 3.841.025 1.907.308 2.875 1.422 2.875 3.292 0 1.919-1.259 3.319-3.381 3.746-1.194.239-2.636.196-3.335.15zm25.397-8.571h-14.342v2.008l.187-.015a51.26 51.26 0 015.822-.335v17.497h2.768v-17.488c1.94 0 3.804.112 5.545.326l.192.022v-2.015h-.172zm2.435 19.094h2.598v-19.094h-2.598v19.094zm21.042-19.094v14.132h-.024c-.101-.115-13.044-14.132-13.044-14.132h-1.32v19.094h1.88v-14.775h.033c.1.114 11.815 13.064 11.815 13.064l1.467 1.713h1.071v-19.096h-1.878z" fill="#fff"/></g><g vectornator:layerName="Layer 2" fill="#fff"><path d="M237.168 286.981l10.41-37.538h6.155v38.547l-16.565-1.009zM150.264 231.885v4.712l-5.221 1.077-3.824-4.569 9.0Line truncated

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

+26 -7
View File
@@ -60,7 +60,7 @@ export interface OverlayTool {
visible: boolean; visible: boolean;
} }
export type OverlayId = string; export type OverlayId = string;
export type OverlayIds = Array<OverlayId>; export type OverlayIds = OverlayId[];
export interface OverlayPosition { x: number; y: number; } export interface OverlayPosition { x: number; y: number; }
export interface OverlayItem { export interface OverlayItem {
position: OverlayPosition; position: OverlayPosition;
@@ -92,7 +92,7 @@ export type EventMode =
| "q3"; | "q3";
export interface CourseStatus { export interface CourseStatus {
courseFlag: CourseFlags; courseFlag: CourseFlags;
sectorFlags: Array<CourseFlag>; sectorFlags: CourseFlag[];
safetyCar: SafetyCarStatus; safetyCar: SafetyCarStatus;
virtualSafetyCar: VirtualSafetyCarStatus; virtualSafetyCar: VirtualSafetyCarStatus;
} }
@@ -106,11 +106,11 @@ export type CourseFlag =
| "redYellow"; | "redYellow";
export type SafetyCarStatus = "clear" | "starting" | "out" | "ending"; export type SafetyCarStatus = "clear" | "starting" | "out" | "ending";
export type VirtualSafetyCarStatus = "clear" | "out" | "ending"; export type VirtualSafetyCarStatus = "clear" | "out" | "ending";
export type Grid = Array<Car>; // Grid order does not change. export type Grid = Car[]; // Grid order does not change.
export interface Car { export interface Car {
position: number; position: number;
driver: Driver; driver: Driver;
// status: ???; // retired status: CarStatus;
// flags: ???, // blue, red, meatball, black/white, black // flags: ???, // blue, red, meatball, black/white, black
// notices: ???; // Penalties, warnings, investigations, blue flags, etc // notices: ???; // Penalties, warnings, investigations, blue flags, etc
// distance: number; // distance: number;
@@ -193,7 +193,7 @@ export type TeamFullName =
// Broadcast Director // Broadcast Director
export interface BroadcastDirector { export interface BroadcastDirector {
selectedCars: Array<Car>; selectedCars: Car[];
} }
// Broadcast Graphics // Broadcast Graphics
@@ -213,14 +213,33 @@ export interface BGBaseState {
export type OpenState = number; export type OpenState = number;
export interface BroadcastGraphics { export interface BroadcastGraphics {
// timingBoard: BGTimingBoard; timingBoard: BGTimingBoard;
// statusIndicator: BGStatusIndicator;
// indicators: BGIndicators // indicators: BGIndicators
chyrons: Optional<BGChyrons>; chyrons: Optional<BGChyrons>;
// gems: BGGems // gems: BGGems
// toasts: BGToasts; // 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 // Chyrons
export type BGChyronMode = string; export type BGChyronMode = string;
export type BGChyronSubMode = string; export type BGChyronSubMode = string;
+29
View File
@@ -0,0 +1,29 @@
// To support enums https://stackoverflow.com/a/66939542
export * from "./state.d";
export enum CarStatus {
Normal,
Retired,
InPit,
OutLap,
InLap,
DidNotStart,
}
export enum BGStatusIndicatorModes {
NormalNarrow, // "LAP" above "##/##" lap count.
NormalWide, // "LAP" to the left of "##/##" lap count.
}
export enum BGTimingTowerModes {
Hidden, // Not on display.
Minimum, // Just the driver name abbrv.
Leader, // Leader timing.
Interval, // Interval timing.
FullName, // Displays full name.
}
export enum BGTimingTowerFocusedCarsMode {
None, // When no special treatments are made.
Portrait, // When it shows the portrait of the driver.
}
+95
View File
@@ -0,0 +1,95 @@
import { andMatch, andWith, orMatch, orWith } from "./common";
describe("common", () => {
describe("andMatch", () => {
describe("detects correct matches", () => {
it("works with number", () => {
expect(andMatch(5, 2 + 3, 5 + 0, 6 - 1)).toBe(true);
});
it("works with boolean", () => {
expect(andMatch(true, 1 == 1, !false, !!1)).toBe(true);
});
});
describe("detects incorrect matches", () => {
it("works with number", () => {
expect(andMatch(5, 4 + 1, 3 + 0)).toBe(false);
});
it("works with boolean", () => {
expect(andMatch(true, !true, !!0)).toBe(false);
});
});
describe("sensibly handles odd situations", () => {
it("returns truthiness of self when no rights given", () => {
expect(andMatch(5)).toBe(true);
expect(andMatch(0)).toBe(false);
});
});
});
describe("orMatch", () => {
describe("detects correct matches", () => {
it("works with number", () => {
expect(orMatch(5, 0, 0, 6 - 1)).toBe(true);
});
it("works with boolean", () => {
expect(orMatch(true, false, !false)).toBe(true);
});
});
describe("detects incorrect matches", () => {
it("works with number", () => {
expect(orMatch(5, 2, 3)).toBe(false);
});
it("works with boolean", () => {
expect(orMatch(false, true, !!1)).toBe(false);
});
});
describe("sensibly handles odd situations", () => {
it("returns truthiness of self when no rights given", () => {
expect(orMatch(5)).toBe(true);
expect(orMatch(0)).toBe(false);
});
});
});
const greaterCompare = (l: number, r: number) => l > r;
describe("andWith", () => {
describe("detects correct matches", () => {
it("works with number", () => {
expect(andWith(10, greaterCompare, 5, 3, 9)).toBe(true);
});
});
describe("detects incorrect matches", () => {
it("works with number", () => {
expect(andWith(5, greaterCompare, 4, 10)).toBe(false);
});
});
describe("sensibly handles odd situations", () => {
it("returns truthiness of self when no rights given", () => {
expect(andWith(5, greaterCompare)).toBe(true);
});
});
});
describe("orWith", () => {
describe("detects correct matches", () => {
it("works with number", () => {
expect(orWith(5, greaterCompare, 10, 15, 3)).toBe(true);
});
});
describe("detects incorrect matches", () => {
it("works with number", () => {
expect(orWith(5, greaterCompare, 10, 20)).toBe(false);
});
});
describe("sensibly handles odd situations", () => {
it("returns truthiness of self when no rights given", () => {
expect(orWith(5, greaterCompare)).toBe(true);
});
});
});
});
+91
View File
@@ -0,0 +1,91 @@
/**
* Helpful utility function to save on ugly looking chains of && checks.
* Before: (myObj.modeA === MyModes.On && myObj.modeB === MyModes.On)
* After: andMatch(MyModes.On, myObj.modeA, myObj.modeB)
* Uses strict equals.
* @param left The argument you're checking.
* @param rights n arguments you're checking against.
* @returns True if all match. If no rights given returns truthiness of left.
*/
export function andMatch<T>(left: T, ...rights: T[]): boolean {
if (rights.length === 0) {
return !!left;
}
for (const right of rights) {
if (left !== right) {
return false;
}
}
return true;
}
/**
* Helpful utility function to save on ugly looking chains of || checks.
* @param left The argument you're checking.
* @param rights n arguments you're checking against.
* @returns True if any match. If no rights given returns truthiness of left.
*/
export function orMatch<T>(left: T, ...rights: T[]): boolean {
if (rights.length === 0) {
return !!left;
}
for (const right of rights) {
if (left === right) {
return true;
}
}
return false;
}
/**
* Helpful function that essentially repackages the functionality of Array.every()
* into a slightly more sensible form.
* @param left The argument you're checking.
* @param func Predicate that returns a boolean.
* @param rights n arguments you're checking against.
* @returns True if all match. If no rights given returns truthiness of left.
*/
export function andWith<T>(
left: T,
func: (l: T, r: T) => boolean,
...rights: T[]
): boolean {
if (rights.length === 0) {
return !!left;
}
for (const right of rights) {
if (!func(left, right)) {
return false;
}
}
return true;
}
/**
* Helpful function that essentially repackages the functionality of Array.some()
* into a slightly more sensible form.
* @param left The argument you're checking.
* @param func Predicate that returns a boolean.
* @param rights n arguments you're checking against.
* @returns True if any match. If no rights given returns truthiness of left.
*/
export function orWith<T>(
left: T,
func: (l: T, r: T) => boolean,
...rights: T[]
): boolean {
if (rights.length === 0) {
return !!left;
}
for (const right of rights) {
if (func(left, right)) {
return true;
}
}
return false;
}