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:
1 parent
b7d1b23dff
commit
58da0e4895
13 files changed
+86
-35
No files matched your search
@@ -2,14 +2,16 @@ import { useSelector } from "react-redux";
|
||||
|
||||
import { broadcastGraphicsSelector } from "../../../../features/broadcast/graphics/broadcastGraphicsSelector";
|
||||
import { workspaceSelector } from "../../../../features/workspace/workspaceSelector";
|
||||
import { Placement } from "../../../../types/style";
|
||||
|
||||
import { ChyronDriver } from "../Driver";
|
||||
import { DoubleChyronContainer } from "./styles";
|
||||
import { ChyronPlacement, DoubleChyronContainer } from "./styles";
|
||||
|
||||
type ChyronContainerProps = {
|
||||
debug?: boolean,
|
||||
placement?: Placement,
|
||||
};
|
||||
export function ChyronContainer({ debug = false }: ChyronContainerProps) {
|
||||
export function ChyronContainer({ debug = false, placement = {} }: ChyronContainerProps) {
|
||||
const { chyrons } = useSelector(broadcastGraphicsSelector);
|
||||
const { debugDurationMultiplier } = useSelector(workspaceSelector);
|
||||
|
||||
@@ -23,19 +25,20 @@ export function ChyronContainer({ debug = false }: ChyronContainerProps) {
|
||||
debugDurationMultiplier={debug ? debugDurationMultiplier : 1}
|
||||
/>
|
||||
);
|
||||
if (chyrons.subMode === "medium" && chyrons.driver.secondary) {
|
||||
return (
|
||||
<DoubleChyronContainer>
|
||||
{primary}
|
||||
<ChyronDriver
|
||||
chyronData={chyrons.driver.secondary}
|
||||
subMode={chyrons.subMode}
|
||||
openState={chyrons.openState}
|
||||
debugDurationMultiplier={debug ? debugDurationMultiplier : 1}
|
||||
/>
|
||||
</DoubleChyronContainer>
|
||||
);
|
||||
} else {
|
||||
return primary;
|
||||
}
|
||||
|
||||
return (
|
||||
<ChyronPlacement placement={placement}>
|
||||
{chyrons.subMode === "medium" && chyrons.driver.secondary ? (
|
||||
<DoubleChyronContainer>
|
||||
{primary}
|
||||
<ChyronDriver
|
||||
chyronData={chyrons.driver.secondary}
|
||||
subMode={chyrons.subMode}
|
||||
openState={chyrons.openState}
|
||||
debugDurationMultiplier={debug ? debugDurationMultiplier : 1}
|
||||
/>
|
||||
</DoubleChyronContainer>
|
||||
) : primary}
|
||||
</ChyronPlacement>
|
||||
);
|
||||
}
|
||||
@@ -1,7 +1,19 @@
|
||||
import styled from "styled-components/macro";
|
||||
|
||||
import { Placement } from "../../../../types/style";
|
||||
import { placementStyleRules } from "../../../../utils/styling";
|
||||
|
||||
export const DoubleChyronContainer = styled.div`
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
width: 1196px;
|
||||
`;
|
||||
|
||||
|
||||
type ChyronPlacementProps = {
|
||||
placement: Placement,
|
||||
};
|
||||
export const ChyronPlacement = styled.div<ChyronPlacementProps>`
|
||||
position: absolute;
|
||||
${({ placement }) => placementStyleRules(placement)}
|
||||
`;
|
||||
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user