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:
1 parent
8bf413ba31
commit
22ebab1101
19 files changed
+521
-41
No files matched your search
@@ -21,7 +21,6 @@ import {
|
||||
LastName,
|
||||
NameContainer,
|
||||
NumberContainer,
|
||||
Spacer,
|
||||
TeamColorBar,
|
||||
TeamName,
|
||||
TextContainer,
|
||||
@@ -29,6 +28,7 @@ import {
|
||||
DriverPortraitContainer,
|
||||
} from "./styles";
|
||||
import { VenetianBlindsTransition } from "../../Common/VenetianBlindsTransition";
|
||||
import { Spacer } from "../../Common/Spacer.styled";
|
||||
|
||||
type ChyronDriverProps = {
|
||||
chyronData: BGChyronDriver,
|
||||
|
||||
@@ -171,16 +171,6 @@ export const TeamName = styled.div<TeamNameProps>`
|
||||
`;
|
||||
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 = {
|
||||
height: 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 { VenetianBlindsWorkspace } from "./CustomWorkSpaces/VenetianBlindsWorkspace";
|
||||
import { VenetianBlindsPrototypeControls } from "./PrototypingControls/VenetianBlindsPrototype";
|
||||
import { TimingTower } from "../BroadcastGraphics/TimingBoard/TimingTower";
|
||||
|
||||
const WORKSPACE_LIST_WIDTH = 180;
|
||||
|
||||
@@ -89,6 +90,20 @@ export default function Workspaces() {
|
||||
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>} />
|
||||
</Routes>
|
||||
</FullScreenContainer>
|
||||
|
||||
Reference in new issue
Block a user