ISSUE-062 - Basic base in place with no real interactivity or anything like that.
Saving progress for the day. It's dinner time!
This commit is contained in:
1 parent
c42f64f43c
commit
28e0e7f3d4
12 files changed
+77
-27
No files matched your search
@@ -2,7 +2,7 @@ import { useSpring } from "@react-spring/web";
|
|||||||
import { useDispatch } from "react-redux";
|
import { useDispatch } from "react-redux";
|
||||||
|
|
||||||
import { BGChyronDriver, BGChyronSubMode, OpenState } from "../../../../types/state";
|
import { BGChyronDriver, BGChyronSubMode, OpenState } from "../../../../types/state";
|
||||||
import { Fraction } from "../../../../types/style";
|
import { DebugDurationProps, Fraction } from "../../../../types/style";
|
||||||
import { clearChyrons } from "../../../../features/broadcast/graphics/broadcastGraphicsSlice";
|
import { clearChyrons } from "../../../../features/broadcast/graphics/broadcastGraphicsSlice";
|
||||||
import { theme } from "../../../../shared/theme";
|
import { theme } from "../../../../shared/theme";
|
||||||
import { outlineClipPath } from "../../../../utils/styling";
|
import { outlineClipPath } from "../../../../utils/styling";
|
||||||
@@ -30,11 +30,10 @@ import {
|
|||||||
import { VenetianBlindsTransition } from "../../Common/VenetianBlindsTransition";
|
import { VenetianBlindsTransition } from "../../Common/VenetianBlindsTransition";
|
||||||
import { Spacer } from "../../Common/Spacer.styled";
|
import { Spacer } from "../../Common/Spacer.styled";
|
||||||
|
|
||||||
type ChyronDriverProps = {
|
type ChyronDriverProps = DebugDurationProps & {
|
||||||
chyronData: BGChyronDriver,
|
chyronData: BGChyronDriver,
|
||||||
subMode: BGChyronSubMode,
|
subMode: BGChyronSubMode,
|
||||||
openState: OpenState,
|
openState: OpenState,
|
||||||
debugDurationMultiplier?: Fraction,
|
|
||||||
};
|
};
|
||||||
export function ChyronDriver({
|
export function ChyronDriver({
|
||||||
chyronData,
|
chyronData,
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
import { useSelector } from "react-redux";
|
||||||
|
|
||||||
|
import { broadcastGraphicsSelector } from "../../../../features/broadcast/graphics/broadcastGraphicsSelector";
|
||||||
|
import { DebugDurationProps } from "../../../../types/style";
|
||||||
|
|
||||||
|
import { StatusIndicatorBase } from "./styles";
|
||||||
|
|
||||||
|
type StatusIndicatorProps = DebugDurationProps;
|
||||||
|
|
||||||
|
export function StatusIndicator({
|
||||||
|
debugDurationMultiplier: DDM = 1.0,
|
||||||
|
}: StatusIndicatorProps) {
|
||||||
|
const { timingBoard: { statusIndicator: { mode } } } =
|
||||||
|
useSelector(broadcastGraphicsSelector);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<StatusIndicatorBase
|
||||||
|
mode={mode}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export * from "./StatusIndicator";
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
import styled, { css } from "styled-components";
|
||||||
|
|
||||||
|
import { BGStatusIndicatorModes } from "../../../../types/state";
|
||||||
|
|
||||||
|
type StatusIndicatorBaseProps = {
|
||||||
|
mode: BGStatusIndicatorModes,
|
||||||
|
};
|
||||||
|
export const StatusIndicatorBase = styled.div<StatusIndicatorBaseProps>`
|
||||||
|
background-color: black;
|
||||||
|
border-top-right-radius: ${p => p.theme.design.statusIndicator.roundedCornerRadiusPx}px;
|
||||||
|
height: ${p => p.theme.design.statusIndicator.heightNormalPx}px;
|
||||||
|
width: ${({ theme: { design: { timingTower } }, mode }) => {
|
||||||
|
if (mode === BGStatusIndicatorModes.LapNarrow) {
|
||||||
|
return timingTower.rowLeftHalfWidthPx;
|
||||||
|
}
|
||||||
|
if (mode === BGStatusIndicatorModes.LapWide) {
|
||||||
|
return timingTower.rowLeftHalfWidthPx + timingTower.rowRightHalfWidthPx;
|
||||||
|
}
|
||||||
|
return 10;
|
||||||
|
}}px;
|
||||||
|
`;
|
||||||
|
StatusIndicatorBase.displayName = "StatusIndicatorBase";
|
||||||
@@ -1,23 +1,23 @@
|
|||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
|
|
||||||
import { workspaceSelector } from "../../../features/workspace/workspaceSelector";
|
import { workspaceSelector } from "../../../features/workspace/workspaceSelector";
|
||||||
import { theme } from "../../../shared/theme";
|
|
||||||
|
|
||||||
import { TimingBoardLayout } from "./styles";
|
import { TimingBoardLayout } from "./styles";
|
||||||
import { MockupBlock } from "../../Common/MockupBlock.styled";
|
|
||||||
import { TimingTower } from "./TimingTower";
|
import { TimingTower } from "./TimingTower";
|
||||||
|
import { StatusIndicator } from "./StatusIndicator";
|
||||||
|
|
||||||
export function TimingBoard() {
|
type TimingBoardProps = {
|
||||||
|
debug?: boolean,
|
||||||
|
};
|
||||||
|
export function TimingBoard({ debug = false }: TimingBoardProps) {
|
||||||
const { debugDurationMultiplier } = useSelector(workspaceSelector);
|
const { debugDurationMultiplier } = useSelector(workspaceSelector);
|
||||||
return (
|
return (
|
||||||
<TimingBoardLayout>
|
<TimingBoardLayout>
|
||||||
<MockupBlock
|
<StatusIndicator
|
||||||
height="73px"
|
debugDurationMultiplier={debug ? debugDurationMultiplier : 1}
|
||||||
width={`${theme.design.timingTower.rowLeftHalfWidthPx}px`}
|
|
||||||
color="black"
|
|
||||||
/>
|
/>
|
||||||
<TimingTower
|
<TimingTower
|
||||||
debugDurationMultiplier={debugDurationMultiplier}
|
debugDurationMultiplier={debug ? debugDurationMultiplier : 1}
|
||||||
/>
|
/>
|
||||||
</TimingBoardLayout>
|
</TimingBoardLayout>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -4,14 +4,12 @@ import { useSelector } from "react-redux";
|
|||||||
import { broadcastGraphicsSelector } from "../../../../features/broadcast/graphics/broadcastGraphicsSelector";
|
import { broadcastGraphicsSelector } from "../../../../features/broadcast/graphics/broadcastGraphicsSelector";
|
||||||
import { eventSelector } from "../../../../features/event/eventSelector";
|
import { eventSelector } from "../../../../features/event/eventSelector";
|
||||||
import { BGTimingTowerDisplayMode, CarStatus } from "../../../../types/state";
|
import { BGTimingTowerDisplayMode, CarStatus } from "../../../../types/state";
|
||||||
import { Fraction } from "../../../../types/style";
|
import { DebugDurationProps } from "../../../../types/style";
|
||||||
|
|
||||||
import { RowsContainer } from "./styles";
|
import { RowsContainer } from "./styles";
|
||||||
import { TimingTowerRow } from "./TimingTowerRow";
|
import { TimingTowerRow } from "./TimingTowerRow";
|
||||||
|
|
||||||
type TimingTowerProps = {
|
type TimingTowerProps = DebugDurationProps;
|
||||||
debugDurationMultiplier?: Fraction,
|
|
||||||
};
|
|
||||||
|
|
||||||
export function TimingTower({ debugDurationMultiplier: DDM }: TimingTowerProps) {
|
export function TimingTower({ debugDurationMultiplier: DDM }: TimingTowerProps) {
|
||||||
const { lastUpdate, grid, trackLength } = useSelector(eventSelector);
|
const { lastUpdate, grid, trackLength } = useSelector(eventSelector);
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { orMatch } from "../../../../utils/common";
|
|||||||
import { getCarAtPos, timeDiff } from "../../../../utils/event";
|
import { getCarAtPos, timeDiff } from "../../../../utils/event";
|
||||||
import { formatTime, outlineClipPath } from "../../../../utils/styling";
|
import { formatTime, outlineClipPath } from "../../../../utils/styling";
|
||||||
|
|
||||||
import { Fraction } from "../../../../types/style";
|
import { DebugDurationProps, Fraction } from "../../../../types/style";
|
||||||
import { Meters, Milliseconds } from "../../../../types/util";
|
import { Meters, Milliseconds } from "../../../../types/util";
|
||||||
import {
|
import {
|
||||||
BGTimingTowerDisplayMode,
|
BGTimingTowerDisplayMode,
|
||||||
@@ -45,7 +45,7 @@ const TRAVEL_DURATION: Milliseconds = 750;
|
|||||||
const FULL_WIDTH_DURATION: Milliseconds = 750;
|
const FULL_WIDTH_DURATION: Milliseconds = 750;
|
||||||
const FULL_WIDTH_CLOSE_DELAY: Milliseconds = 333;
|
const FULL_WIDTH_CLOSE_DELAY: Milliseconds = 333;
|
||||||
|
|
||||||
interface TimingTowerRowProps {
|
type TimingTowerRowProps = DebugDurationProps & {
|
||||||
car: Car;
|
car: Car;
|
||||||
grid: Grid;
|
grid: Grid;
|
||||||
startingCarsCount: number;
|
startingCarsCount: number;
|
||||||
@@ -53,7 +53,6 @@ interface TimingTowerRowProps {
|
|||||||
splitsMode: BGTimingTowerSplitsMode;
|
splitsMode: BGTimingTowerSplitsMode;
|
||||||
displayMode: BGTimingTowerDisplayMode;
|
displayMode: BGTimingTowerDisplayMode;
|
||||||
trackLength: Meters;
|
trackLength: Meters;
|
||||||
debugDurationMultiplier?: Fraction,
|
|
||||||
}
|
}
|
||||||
export function TimingTowerRow({
|
export function TimingTowerRow({
|
||||||
car,
|
car,
|
||||||
@@ -165,14 +164,14 @@ export function TimingTowerRow({
|
|||||||
<RowLeftHalf
|
<RowLeftHalf
|
||||||
roundedCornerTop={
|
roundedCornerTop={
|
||||||
(displayMode === BGTimingTowerDisplayMode.FullLeft &&
|
(displayMode === BGTimingTowerDisplayMode.FullLeft &&
|
||||||
car.position === 1) ? 5 : 0
|
car.position === 1) ? timingTowerTheme.rowRoundedCornerRadiusPx : 0
|
||||||
}
|
}
|
||||||
roundedCornerBottom={
|
roundedCornerBottom={
|
||||||
bottomRounded && orMatch(
|
bottomRounded && orMatch(
|
||||||
displayMode,
|
displayMode,
|
||||||
BGTimingTowerDisplayMode.LeftOnly,
|
BGTimingTowerDisplayMode.LeftOnly,
|
||||||
BGTimingTowerDisplayMode.FullLeft,
|
BGTimingTowerDisplayMode.FullLeft,
|
||||||
) ? 5 : 0
|
) ? timingTowerTheme.rowRoundedCornerRadiusPx : 0
|
||||||
}
|
}
|
||||||
open={displayMode === BGTimingTowerDisplayMode.FullLeft}
|
open={displayMode === BGTimingTowerDisplayMode.FullLeft}
|
||||||
transitionOpeningProps={[{
|
transitionOpeningProps={[{
|
||||||
@@ -312,13 +311,14 @@ export function TimingTowerRow({
|
|||||||
</RowLeftHalf>
|
</RowLeftHalf>
|
||||||
|
|
||||||
<RowRightHalf
|
<RowRightHalf
|
||||||
roundedCornerTop={car.position === 1 ? 5 : 0}
|
roundedCornerTop={car.position === 1
|
||||||
|
? timingTowerTheme.rowRoundedCornerRadiusPx : 0}
|
||||||
roundedCornerBottom={
|
roundedCornerBottom={
|
||||||
bottomRounded && orMatch(
|
bottomRounded && orMatch(
|
||||||
splitsMode,
|
splitsMode,
|
||||||
BGTimingTowerSplitsMode.Leader,
|
BGTimingTowerSplitsMode.Leader,
|
||||||
BGTimingTowerSplitsMode.Interval,
|
BGTimingTowerSplitsMode.Interval,
|
||||||
) ? 5 : 0
|
) ? timingTowerTheme.rowRoundedCornerRadiusPx : 0
|
||||||
}
|
}
|
||||||
open={displayMode === BGTimingTowerDisplayMode.LeftAndRight}
|
open={displayMode === BGTimingTowerDisplayMode.LeftAndRight}
|
||||||
transitionProps={[{
|
transitionProps={[{
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ export default function Workspaces() {
|
|||||||
<Route path="timingBoard" element={
|
<Route path="timingBoard" element={
|
||||||
<Workspace
|
<Workspace
|
||||||
workspaceId="timingBoard"
|
workspaceId="timingBoard"
|
||||||
previewContent={<TimingBoard />}
|
previewContent={<TimingBoard debug />}
|
||||||
prototypeControls={<TimingTowerPrototypeControls />}
|
prototypeControls={<TimingTowerPrototypeControls />}
|
||||||
bleedover={500}
|
bleedover={500}
|
||||||
showAnimationSpeedSelector
|
showAnimationSpeedSelector
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ const DEFAULT_TYRE: Tyre = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const GRID_POSITION_GAP: Meters = 8;
|
const GRID_POSITION_GAP: Meters = 8;
|
||||||
const POLE_TO_START: Meters = 10;
|
const POLE_TO_START: Meters = -10;
|
||||||
|
|
||||||
const initialState: RootState["event"] = {
|
const initialState: RootState["event"] = {
|
||||||
trackName: "Circuit de Spa-Franchorchamps",
|
trackName: "Circuit de Spa-Franchorchamps",
|
||||||
@@ -41,8 +41,7 @@ const initialState: RootState["event"] = {
|
|||||||
progress: {
|
progress: {
|
||||||
startTime: Date.now(),
|
startTime: Date.now(),
|
||||||
timeLimit: 60 * 60 * 2 * 1000,
|
timeLimit: 60 * 60 * 2 * 1000,
|
||||||
currentLap: 1,
|
lapCount: 44,
|
||||||
lapCount: 10,
|
|
||||||
},
|
},
|
||||||
leaderGridSpot: 0,
|
leaderGridSpot: 0,
|
||||||
grid: [
|
grid: [
|
||||||
@@ -255,6 +254,9 @@ export const eventSlice = createSlice({
|
|||||||
state.grid[entry.gridSpot].position = sortedPosition + 1;
|
state.grid[entry.gridSpot].position = sortedPosition + 1;
|
||||||
});
|
});
|
||||||
state.leaderGridSpot = sortingGrid[0].gridSpot;
|
state.leaderGridSpot = sortingGrid[0].gridSpot;
|
||||||
|
state.progress.lapCount =
|
||||||
|
Math.max(1, Math.floor(sortingGrid[0].distance / state.trackLength) + 1);
|
||||||
|
|
||||||
state.lastUpdate = Date.now();
|
state.lastUpdate = Date.now();
|
||||||
},
|
},
|
||||||
increaseDistance: (state, action: PayloadAction<IncreaseDistanceAction>) => {
|
increaseDistance: (state, action: PayloadAction<IncreaseDistanceAction>) => {
|
||||||
|
|||||||
@@ -67,6 +67,10 @@ export const theme = {
|
|||||||
selector: "0.9em",
|
selector: "0.9em",
|
||||||
},
|
},
|
||||||
design: {
|
design: {
|
||||||
|
statusIndicator: {
|
||||||
|
heightNormalPx: 73,
|
||||||
|
roundedCornerRadiusPx: 8,
|
||||||
|
},
|
||||||
timingTower: {
|
timingTower: {
|
||||||
rowHeightPx: 36.5,
|
rowHeightPx: 36.5,
|
||||||
rowLeftHalfWidthPx: 147,
|
rowLeftHalfWidthPx: 147,
|
||||||
@@ -75,6 +79,7 @@ export const theme = {
|
|||||||
teamGemSize: 30,
|
teamGemSize: 30,
|
||||||
posFlagSize: 32,
|
posFlagSize: 32,
|
||||||
nameLeftMargin: 14,
|
nameLeftMargin: 14,
|
||||||
|
rowRoundedCornerRadiusPx: 5,
|
||||||
},
|
},
|
||||||
button: {
|
button: {
|
||||||
borderRadius: "0.25rem",
|
borderRadius: "0.25rem",
|
||||||
|
|||||||
@@ -82,7 +82,6 @@ export interface Event {
|
|||||||
export interface EventProgress {
|
export interface EventProgress {
|
||||||
startTime: Milliseconds;
|
startTime: Milliseconds;
|
||||||
timeLimit: Milliseconds;
|
timeLimit: Milliseconds;
|
||||||
currentLap: number;
|
|
||||||
lapCount: number;
|
lapCount: number;
|
||||||
}
|
}
|
||||||
export enum EventMode {
|
export enum EventMode {
|
||||||
|
|||||||
Vendored
+3
@@ -41,6 +41,9 @@ export interface TransitionArgs {
|
|||||||
delay?: Milliseconds,
|
delay?: Milliseconds,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type DebugDurationProps = {
|
||||||
|
debugDurationMultiplier?: Fraction,
|
||||||
|
};
|
||||||
export type OpenProps = {
|
export type OpenProps = {
|
||||||
open: boolean,
|
open: boolean,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in new issue
Block a user