ISSUE-032 - Have Chyron prototyping controls configured and hooked up.
Support for double driver chyrons. Serious refactoring of the BroadcastGraphics states. Simplification and improvements to how the chyron states work (I was using interfaces in a way that was incompatible with reality and have fixed it).
This commit is contained in:
1 parent
d5b653da9d
commit
0625361a18
16 files changed
+233
-124
No files matched your search
@@ -0,0 +1,32 @@
|
||||
import { Inline } from "@bedrock-layout/inline";
|
||||
import { useSelector } from "react-redux";
|
||||
|
||||
import { broadcastGraphicsSelector } from "../../../../features/broadcast/graphics/broadcastGraphicsSelector";
|
||||
|
||||
import { ChyronDriver } from "../Driver";
|
||||
import { Spacer } from "./styles";
|
||||
|
||||
export function ChyronContainer() {
|
||||
const { chyrons } = useSelector(broadcastGraphicsSelector);
|
||||
|
||||
if (chyrons == null || chyrons.driver == null) return null;
|
||||
|
||||
return (
|
||||
<Inline gutter="none">
|
||||
|
||||
<ChyronDriver
|
||||
chyronData={chyrons.driver.primary}
|
||||
subMode={chyrons.subMode}
|
||||
/>
|
||||
{chyrons.subMode == "medium" && chyrons.driver.secondary && (
|
||||
<>
|
||||
<Spacer />
|
||||
<ChyronDriver
|
||||
chyronData={chyrons.driver.secondary}
|
||||
subMode={chyrons.subMode}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</Inline>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from "./ChyronContainer";
|
||||
@@ -0,0 +1,6 @@
|
||||
import styled from "styled-components";
|
||||
|
||||
export const Spacer = styled.div`
|
||||
width: 32px;
|
||||
`;
|
||||
Spacer.displayName = "Spacer";
|
||||
@@ -1,3 +1,7 @@
|
||||
import { BGChyronDriver, BGChyronSubMode } from "../../../../types/state";
|
||||
|
||||
import { theme } from "../../../../shared/theme";
|
||||
|
||||
import { DriverNumber } from "../../Common/DriverNumber";
|
||||
import { AngledFlag } from "../../Common/AngledFlag";
|
||||
import {
|
||||
@@ -14,37 +18,46 @@ import {
|
||||
TextContainer,
|
||||
FlagContainer,
|
||||
} from "./styles";
|
||||
import { drivers } from "../../../../domain/data/teams";
|
||||
import { theme } from "../../../../shared/theme";
|
||||
|
||||
export function ChyronDriver() {
|
||||
// TODO - Get driver details from Redux.
|
||||
const driver = drivers["hamilton"];
|
||||
const baseWidth = 582;
|
||||
const baseHeight = 72;
|
||||
type ChyronDriverProps = {
|
||||
chyronData: BGChyronDriver,
|
||||
subMode: BGChyronSubMode,
|
||||
};
|
||||
export function ChyronDriver({ chyronData, subMode }: ChyronDriverProps) {
|
||||
const [baseWidth, baseHeight] = subMode === "medium" ? [582, 72]
|
||||
: subMode === "large" ? [638, 98]
|
||||
: [0, 0];
|
||||
|
||||
const { car, flagMode, showPosFlag, showDriverNumber } = chyronData;
|
||||
|
||||
return (
|
||||
<BaseBackground width={baseWidth} height={baseHeight}>
|
||||
<Spacer width="6px" />
|
||||
<PositionFlag containerHeight={baseHeight}>
|
||||
<PositionNumber containerHeight={baseHeight}>1</PositionNumber>
|
||||
</PositionFlag>
|
||||
{showPosFlag && (
|
||||
<PositionFlag containerHeight={baseHeight}>
|
||||
<PositionNumber containerHeight={baseHeight}>
|
||||
{car.position}
|
||||
</PositionNumber>
|
||||
</PositionFlag>
|
||||
)}
|
||||
<Spacer width="8px" />
|
||||
<TeamColorBar color={theme.colors.teams[driver.team.id]} />
|
||||
<TeamColorBar color={theme.colors.teams[car.driver.team.id]} />
|
||||
<Spacer width="8px" />
|
||||
<TextContainer>
|
||||
<NameContainer>
|
||||
<FirstName>{driver.firstName}</FirstName>
|
||||
<LastName>{driver.lastName}</LastName>
|
||||
<NumberContainer>
|
||||
<DriverNumber
|
||||
teamId={driver.team.id}
|
||||
fontSize="29px"
|
||||
number={driver.number}
|
||||
/>
|
||||
</NumberContainer>
|
||||
<FirstName>{car.driver.firstName}</FirstName>
|
||||
<LastName>{car.driver.lastName}</LastName>
|
||||
{showDriverNumber && (
|
||||
<NumberContainer>
|
||||
<DriverNumber
|
||||
teamId={car.driver.team.id}
|
||||
fontSize="29px"
|
||||
number={car.driver.number}
|
||||
/>
|
||||
</NumberContainer>
|
||||
)}
|
||||
</NameContainer>
|
||||
<TeamName>{driver.team.shortName}</TeamName>
|
||||
<TeamName>{car.driver.team.shortName}</TeamName>
|
||||
</TextContainer>
|
||||
<FlagContainer
|
||||
height={baseHeight * 0.9}
|
||||
@@ -52,15 +65,11 @@ export function ChyronDriver() {
|
||||
right={-baseHeight * 0.6}
|
||||
>
|
||||
<AngledFlag
|
||||
flagMode="country"
|
||||
flag={driver.nationality}
|
||||
flagMode={flagMode}
|
||||
flag={car.driver.nationality}
|
||||
flagHeight={baseHeight * 0.9}
|
||||
/>
|
||||
</FlagContainer>
|
||||
</BaseBackground>
|
||||
);
|
||||
}
|
||||
|
||||
// export function ChyronDriverStateContainer() {
|
||||
|
||||
// }
|
||||
Reference in new issue
Block a user