ISSUE-053 - Placed Chyrons on video feed.

Adjusted the method that placement is determined. It didn't make much sense to define Placement in state, so I've moved it to the central theme object instead.
I also took the time to support +10 laps and minutes with a special xScale setting for the TimingTowerRows.
This commit is contained in:
Kyle Geib committed 2022-03-17 08:56:55 -04:00
1 parent b7d1b23dff
commit 58da0e4895
13 files changed
+86 -35

No files matched your search

@@ -1,21 +1,21 @@
import { useSelector } from "react-redux";
import { workspaceSelector } from "../../../features/workspace/workspaceSelector";
import { Placement } from "../../../types/style";
import { TimingBoardLayout } from "./styles";
import { TimingTower } from "./TimingTower";
import { StatusIndicator } from "./StatusIndicator";
import { broadcastGraphicsSelector } from "../../../features/broadcast/graphics/broadcastGraphicsSelector";
type TimingBoardProps = {
debug?: boolean,
placement?: Placement,
};
export function TimingBoard({ debug = false }: TimingBoardProps) {
export function TimingBoard({ debug = false, placement = {} }: TimingBoardProps) {
const { debugDurationMultiplier } = useSelector(workspaceSelector);
const { timingBoard } = useSelector(broadcastGraphicsSelector);
return (
<TimingBoardLayout placement={timingBoard.placement}>
<TimingBoardLayout placement={placement}>
<StatusIndicator
debugDurationMultiplier={debug ? debugDurationMultiplier : 1}
/>
@@ -153,6 +153,13 @@ export function TimingTowerRow({
xScale = rightHalfContent.includes(":") ? 0.75 : 0.9;
yScale = rightHalfContent.includes("+") ? 1.1 : 1.0;
if (rightHalfContent.includes("LAPS") && rightHalfContent.length > 7) {
xScale = 0.85; // Extreme edge case where +10 laps or more behind.
}
if (rightHalfContent.length > 9) {
xScale = 0.7; // Extreme edge case where +10 minutes or more behind.
}
}
return (
@@ -221,6 +221,7 @@ export const TimeDiff = styled.span<TimeDiffProps>`
color: ${p => p.theme.colors.textWhite};
font-family: ${p => p.theme.fonts.f1Regular};
font-size: 20px;
white-space: nowrap;
text-align: end;
@@ -7,7 +7,7 @@ type TimingBoardLayoutProps = {
placement: Placement,
};
export const TimingBoardLayout = styled.div<TimingBoardLayoutProps>`
position: relative;
position: absolute;
${({ placement }) => placementStyleRules(placement)}
display: flex;