diff --git a/src/components/BroadcastGraphics/Chyrons/Driver/ChyronDriver.tsx b/src/components/BroadcastGraphics/Chyrons/Driver/ChyronDriver.tsx new file mode 100644 index 0000000..c0c223d --- /dev/null +++ b/src/components/BroadcastGraphics/Chyrons/Driver/ChyronDriver.tsx @@ -0,0 +1,62 @@ +import { DriverNumber } from "../../Common/DriverNumber"; +import { AngledFlag } from "../../Common/AngledFlag"; +import { + BaseBackground, + FirstName, + PositionNumber, + LastName, + NameContainer, + NumberContainer, + PositionFlag, + Spacer, + TeamColorBar, + TeamName, + 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; + + return ( + + + + 1 + + + + + + + {driver.firstName} + {driver.lastName} + + + + + {driver.team.shortName} + + + + + + ); +} diff --git a/src/components/BroadcastGraphics/Chyrons/Driver/index.ts b/src/components/BroadcastGraphics/Chyrons/Driver/index.ts new file mode 100644 index 0000000..0f3ec76 --- /dev/null +++ b/src/components/BroadcastGraphics/Chyrons/Driver/index.ts @@ -0,0 +1 @@ +export * from "./ChyronDriver"; diff --git a/src/components/BroadcastGraphics/Chyrons/Driver/styles.ts b/src/components/BroadcastGraphics/Chyrons/Driver/styles.ts new file mode 100644 index 0000000..48b46c3 --- /dev/null +++ b/src/components/BroadcastGraphics/Chyrons/Driver/styles.ts @@ -0,0 +1,139 @@ +import styled from "styled-components"; +import { Px } from "../../../../types/style"; + +type BaseBackgroundProps = { + width: Px, + height: Px, +}; +export const BaseBackground = styled.div` + position: relative; + width: ${({ width }) => `${width}px`}; + height: ${({ height }) => `${height}px`}; + + display: flex; + align-items: center; + + border-bottom-right-radius: 11px; + background-color: #000; + + overflow: hidden; +`; +BaseBackground.displayName = "BaseBackground"; + +type PositionFlagProps = { + containerHeight: Px, +}; +export const PositionFlag = styled.div` + position: relative; + height: ${({ containerHeight }) => `${containerHeight * 0.85}px`}; + width: ${({ containerHeight }) => `${containerHeight * 0.85}px`}; + + border-bottom-right-radius: 9px; + background-color: #f4f3ee; + + display: flex; + align-items: center; + justify-content: center; +`; +PositionFlag.displayName = "PositionFlag"; + +type PositionNumberProps = { + containerHeight: Px, +}; +export const PositionNumber = styled.span` + font-family: ${p => p.theme.fonts.f1Regular}; + font-size: ${({ containerHeight }) => `${containerHeight * 0.85 * 0.64}px`}; + margin-top: 2px; +`; +PositionNumber.displayName = "PositionNumber"; + +type TeamColorBarProps = { + color: string, +}; +export const TeamColorBar = styled.div` + position: relative; + width: 1%; // 6px; + height: 63%; + + background-color: ${({ color }) => color}; +`; +TeamColorBar.displayName = "TeamColorBar"; + +export const TextContainer = styled.div` + position: relative; + display: flex; + flex-direction: column; + + height: 100%; +`; +TextContainer.displayName = "TextContainer"; + +export const NameContainer = styled.div` + position: relative; + top: 5px; +`; +NameContainer.displayName = "NameContainer"; + +export const FirstName = styled.span` + font-family: ${p => p.theme.fonts.f1Regular}; + color: #fff; + font-size: 25px; +`; +FirstName.displayName = "FirstName"; + +export const LastName = styled.span` + font-family: ${p => p.theme.fonts.f1Bold}; + text-transform: uppercase; + color: #fff; + font-size: 25px; + margin-left: 5px; +`; +LastName.displayName = "LastName"; + +export const NumberContainer = styled.div` + position: relative; + display: inline; + + bottom: 3px; + left: 10px; +`; +NumberContainer.displayName = "NumberContainer"; + +export const TeamName = styled.div` + position: relative; + font-family: ${p => p.theme.fonts.f1Regular}; + color: #d1d1d1; + font-size: 20px; +`; +TeamName.displayName = "TeamName"; + + +type SpacerProps = { + width?: string, + height?: string; +}; +export const Spacer = styled.div` + width: ${({ width = "0" }) => width}; + height: ${({ height = "0" }) => height}; +`; +Spacer.displayName = "Spacer"; + +type FlagContainerProps = { + height: Px, + width: Px, + right: Px, +}; +export const FlagContainer = styled.div` + position: absolute; + right: ${({ right }) => `${right}px`}; + + display: flex; + align-items: center; + justify-content: flex-end; + + height: ${({ height }) => `${height}px`}; + width: ${({ width }) => `${width}px`}; + + overflow: hidden; +`; +FlagContainer.displayName = "FlagContainer"; diff --git a/src/components/BroadcastGraphics/Common/AngledFlag/AngledFlag.tsx b/src/components/BroadcastGraphics/Common/AngledFlag/AngledFlag.tsx new file mode 100644 index 0000000..4a36388 --- /dev/null +++ b/src/components/BroadcastGraphics/Common/AngledFlag/AngledFlag.tsx @@ -0,0 +1,40 @@ +import { FlagMode } from "../../../../types/state"; +import { Px } from "../../../../types/style"; +import { Container, NationalFlag, Slant, Sheen, NationalFlagEdge } from "./styles"; + +const flags = require.context("../../../../public/images/flags/angled", true); +const logos = require.context("../../../../public/images/logos", true); + +/** + * To look right, country flags need to be 2:1. Additional editing will be + * necessary for some flags to not cut off prominent elements. Ex: China's flag + * would have its stars mostly cut out without edits to place them closer to the + * center. + */ +type AngledFlagProps = { + flagMode: FlagMode, + flag: string, + flagHeight: Px, +}; +export function AngledFlag({ flagMode, flag, flagHeight }: AngledFlagProps) { + return ( + + + {flagMode === "country" ? ( + <> + + + + ) : null} + + + ); +} diff --git a/src/components/BroadcastGraphics/Common/AngledFlag/index.ts b/src/components/BroadcastGraphics/Common/AngledFlag/index.ts new file mode 100644 index 0000000..2d90788 --- /dev/null +++ b/src/components/BroadcastGraphics/Common/AngledFlag/index.ts @@ -0,0 +1 @@ +export * from "./AngledFlag"; diff --git a/src/components/BroadcastGraphics/Common/AngledFlag/styles.ts b/src/components/BroadcastGraphics/Common/AngledFlag/styles.ts new file mode 100644 index 0000000..796e178 --- /dev/null +++ b/src/components/BroadcastGraphics/Common/AngledFlag/styles.ts @@ -0,0 +1,101 @@ +import styled from "styled-components"; +import { Px } from "../../../../types/style"; + +type ContainerProps = { + height: Px, + width: Px, +}; +export const Container = styled.div` + position: relative; + overflow: hidden; + display: flex; + align-items: center; + justify-content: center; + + width: ${({ width }) => `${width}px`}; + height: ${({ height }) => `${height}px`}; + mask-image: linear-gradient( + to bottom, + transparent 0%, + transparent 10%, + black 40%, + black 60%, + transparent 90%, + transparent 100% + ); +`; +Container.displayName = "Container"; + +type NationalFlagProps = { + height: Px, +}; +export const NationalFlag = styled.img` + max-inline-size: unset; + height: ${({ height }) => `${height}px`}; + clip-path: polygon(50% 0, 100% 0, 100% 30%, 66% 100%, 0 100%, 0 100%); + mask-image: linear-gradient( + 60deg, + transparent 0%, + black 15%, + black 85%, + transparent 100% + ); +`; +NationalFlag.displayName = "NationalFlag"; + +type SlashProps = { + x: Px, + height: Px, + girth: Px, +}; +export const Sheen = styled.div` + position: absolute; + height: ${({ height }) => `${height}px`}; + width: ${({ girth }) => `${girth}px`}; + + background: linear-gradient( + 25deg, + black 0%, + black 25%, + rgba(255, 255, 255, 0.15) 45%, + rgba(255, 255, 255, 0.15) 55%, + black 75%, + black 100% + ); + font-size: ${({ height }) => `${height}px`}; // Hack to let me use em. + + box-shadow: + 0.02em 0 0.005em 0.015em rgba(0, 0, 0, 0.2), + 1em 0 0 1em rgba(0, 0, 0, 0.5); + transform: skew(-45deg, 0deg) translateX(${({ x }) => `${x}px`}); + + border-left: 0.015em solid rgba(255, 255, 255, 0.25); +`; +Sheen.displayName = "Sheen"; + +export const Slant = styled.div` + position: absolute; + height: ${({ height }) => `${height}px`}; + width: ${({ girth }) => `${girth}px`}; + + background: #1a1a28; + transform: skewX(-45deg) translateX(${({ x }) => `${x}px`}); +`; +Slant.displayName = "Slant"; + +export const NationalFlagEdge = styled.div` + position: absolute; + height: ${({ height }) => `${height}px`}; + width: ${({ girth }) => `${girth}px`}; + + background: ${p => p.theme.colors.lightGrey}; + opacity: 0.5; + transform: skewX(-45deg) translateX(${({ x }) => `${x}px`}); + + mask-image: linear-gradient( + to top, + transparent 0%, + transparent 10%, + black 100% + ); +`; diff --git a/src/components/BroadcastGraphics/Common/DriverNumber/DriverNumber.tsx b/src/components/BroadcastGraphics/Common/DriverNumber/DriverNumber.tsx new file mode 100644 index 0000000..d4502ab --- /dev/null +++ b/src/components/BroadcastGraphics/Common/DriverNumber/DriverNumber.tsx @@ -0,0 +1,44 @@ +import { TeamId } from "../../../../types/state"; +import { getTeamNumberStyle } from "../../../../utils/dataLookup"; +import { NumberContainer, ShadowNumber, StrokeNumber } from "./styles"; + +type DriverNumberProps = { + number: number, + fontSize: string, + teamId: TeamId, +}; +export function DriverNumber({ number, fontSize, teamId }: DriverNumberProps) { + const style = getTeamNumberStyle(teamId); + return ( + + {style.rules.map((rule, i) => { + if (rule.type === "stroke") { + return ( + + {number} + + ); + } else if (rule.type === "shadow") { + return ( + + {number} + + ); + } + })} + + ); +} diff --git a/src/components/BroadcastGraphics/Common/DriverNumber/index.ts b/src/components/BroadcastGraphics/Common/DriverNumber/index.ts new file mode 100644 index 0000000..1432e1c --- /dev/null +++ b/src/components/BroadcastGraphics/Common/DriverNumber/index.ts @@ -0,0 +1 @@ +export * from "./DriverNumber"; diff --git a/src/components/BroadcastGraphics/Common/DriverNumber/styles.ts b/src/components/BroadcastGraphics/Common/DriverNumber/styles.ts new file mode 100644 index 0000000..620c90c --- /dev/null +++ b/src/components/BroadcastGraphics/Common/DriverNumber/styles.ts @@ -0,0 +1,40 @@ +import styled from "styled-components"; + +export const NumberContainer = styled.div` + position: relative; + display: inline; +`; +NumberContainer.displayName = "NumberContainer"; + +type NumberProps = { + fontFamily: string, + fontSize: string, + numberColor: string, +} +type StrokeNumberProps = NumberProps & { + strokeColor: string, + strokeWidth: string, +} +export const StrokeNumber = styled.span` + position: absolute; + font-family: ${({ fontFamily }) => fontFamily}; + font-size: ${({ fontSize }) => fontSize}; + color: ${({ numberColor }) => numberColor}; + + -webkit-text-stroke-color: ${({ strokeColor }) => strokeColor}; + -webkit-text-stroke-width: ${({ strokeWidth }) => strokeWidth}; +`; +StrokeNumber.displayName = "StrokeNumber"; + +type ShadowNumberProps = NumberProps & { + shadowProperties: string, +}; +export const ShadowNumber = styled.span` + position: absolute; + font-family: ${({ fontFamily }) => fontFamily}; + font-size: ${({ fontSize }) => fontSize}; + color: ${({ numberColor }) => numberColor}; + + text-shadow: ${({ shadowProperties }) => shadowProperties}; +`; +ShadowNumber.displayName = "ShadowNumber"; diff --git a/src/components/Common/Inputs/ProgressSlider/ProgressSlider.tsx b/src/components/Common/Inputs/ProgressSlider/ProgressSlider.tsx index 46e0d31..8f4a28c 100644 --- a/src/components/Common/Inputs/ProgressSlider/ProgressSlider.tsx +++ b/src/components/Common/Inputs/ProgressSlider/ProgressSlider.tsx @@ -77,7 +77,7 @@ export function ProgressSlider({ ) ? -1 : value > 0.1 ? 4 : 3 // Tuned fitting considerations. } disabled={disabled} - onBarColor={labelColor} + color={labelColor} > {formatter(value)} diff --git a/src/components/Common/Inputs/ProgressSlider/styles.ts b/src/components/Common/Inputs/ProgressSlider/styles.ts index 1b1df95..f881fae 100644 --- a/src/components/Common/Inputs/ProgressSlider/styles.ts +++ b/src/components/Common/Inputs/ProgressSlider/styles.ts @@ -62,7 +62,7 @@ ProgressSliderBarHandle.displayName = "ProgressSliderBarHandle"; type ProgressSliderBarIndicatorProps = { left: number, disabled: boolean, - onBarColor?: string, + color?: string, }; export const ProgressSliderBarIndicator = styled.span` display: block; @@ -72,11 +72,11 @@ export const ProgressSliderBarIndicator = styled.span p.theme.fonts.f1Regular}; font-size: 0.9em; - color: ${({ onBarColor, left, disabled }) => ( + color: ${({ color, left, disabled }) => ( left < 0 ? disabled ? (p => p.theme.colors.darkGrey) - : onBarColor ?? "white" + : color ?? "white" : (p => p.theme.colors.darkGrey) )}; diff --git a/src/components/OverlayTool/OverlayDisplay/OverlayDisplay.tsx b/src/components/OverlayTool/OverlayDisplay/OverlayDisplay.tsx index 516ce92..b9f0d10 100644 --- a/src/components/OverlayTool/OverlayDisplay/OverlayDisplay.tsx +++ b/src/components/OverlayTool/OverlayDisplay/OverlayDisplay.tsx @@ -42,20 +42,17 @@ export function OverlayDisplay({ const newX = args[0].xPos + delta[0]; const newY = args[0].yPos + delta[1]; dispatch(setPosition({ - x: newX >= minX && newX <= maxX ? newX : args[0].xPos, - y: newY >= minY && newY <= maxY ? newY : args[0].yPos, + x: newX >= minX && newX <= maxX ? newX : newX > maxX ? maxX : args[0].xPos, + y: newY >= minY && newY <= maxY ? newY : newY > maxY ? maxY : args[0].yPos, })); }); const xPos = currentOverlayItem?.position.x ?? 0; const yPos = currentOverlayItem?.position.y ?? 0; const transition = useTransition(visible, { - from: { top: 50, opacity: 0 }, - enter: { - top: 0, - opacity: 1, - }, - leave: { top: 50, opacity: 0 }, + from: { opacity: 0 }, + enter: { opacity: 1 }, + leave: { opacity: 0 }, }); // Cannot make an earlier return because all hooks must run or React gets mad. diff --git a/src/components/OverlayTool/OverlayDisplay/styles.ts b/src/components/OverlayTool/OverlayDisplay/styles.ts index 89f5ea2..f43206c 100644 --- a/src/components/OverlayTool/OverlayDisplay/styles.ts +++ b/src/components/OverlayTool/OverlayDisplay/styles.ts @@ -14,6 +14,10 @@ export const OverlayImage = styled.img.attrs(({ src, }))` width: ${({ scale = 100 }) => `${scale}%`}; + &:active { + outline: 2px solid red; + outline-offset: -2px; + } `; OverlayImage.displayName = "OverlayImage"; diff --git a/src/components/Workspaces/CustomWorkSpaces/AngledFlagWorkSpace.tsx b/src/components/Workspaces/CustomWorkSpaces/AngledFlagWorkSpace.tsx new file mode 100644 index 0000000..3fce2ad --- /dev/null +++ b/src/components/Workspaces/CustomWorkSpaces/AngledFlagWorkSpace.tsx @@ -0,0 +1,14 @@ +import { AngledFlag } from "../../BroadcastGraphics/Common/AngledFlag"; +import { BasicBlock } from "./styles"; + +export function AngledFlagWorkSpace() { + return ( + + + + ); +} diff --git a/src/components/Workspaces/CustomWorkSpaces/styles.ts b/src/components/Workspaces/CustomWorkSpaces/styles.ts new file mode 100644 index 0000000..b57472e --- /dev/null +++ b/src/components/Workspaces/CustomWorkSpaces/styles.ts @@ -0,0 +1,21 @@ +import styled from "styled-components"; +import { Px } from "../../../types/style"; + +type BasicBlockProps = { + width: Px, + height: Px, + color: string, + center?: boolean, +} +export const BasicBlock = styled.div` + display: flex; + justify-content: center; + align-items: center; + + width: ${({ width }) => `${width}px`}; + height: ${({ height }) => `${height}px`}; + + background-color: ${({ color }) => color}; + + border-radius: 15px; +`; diff --git a/src/components/Workspaces/Workspace/Workspace.tsx b/src/components/Workspaces/Workspace/Workspace.tsx index 2fac558..6f903ef 100644 --- a/src/components/Workspaces/Workspace/Workspace.tsx +++ b/src/components/Workspaces/Workspace/Workspace.tsx @@ -10,11 +10,10 @@ import { overlayToolSelector } from "../../../features/overlayTool/overlayToolSe import { newWorkspace } from "../../../features/overlayTool/overlayToolSlice"; import { PreviewWindow, H2, ControlsContainer } from "./styles"; -import { WorkspaceControls } from "./WorkspaceControls"; -import { MockupBlock } from "../../Common/MockupBlock.styled"; +import { WorkspaceControls } from "./WorkspaceControls/WorkspaceControls"; import { OverlayDisplay } from "../../OverlayTool"; -import { workspaces } from "../workspaces"; +import { fetchBroadcastGraphic, workspaces } from "../../../domain/data/workspaces"; export const Workspace = () => { const dispatch = useDispatch(); @@ -54,11 +53,7 @@ export const Workspace = () => { dimensions={workspaceProperties.previewWindowDimensions} animatedBG={animatedBG} > - Preview Item + {fetchBroadcastGraphic(workspaceId)} diff --git a/src/components/Workspaces/Workspace/WorkspaceControls.tsx b/src/components/Workspaces/Workspace/WorkspaceControls/WorkspaceControls.tsx similarity index 68% rename from src/components/Workspaces/Workspace/WorkspaceControls.tsx rename to src/components/Workspaces/Workspace/WorkspaceControls/WorkspaceControls.tsx index 406d9be..ea90e0a 100644 --- a/src/components/Workspaces/Workspace/WorkspaceControls.tsx +++ b/src/components/Workspaces/Workspace/WorkspaceControls/WorkspaceControls.tsx @@ -2,11 +2,11 @@ import { Grid } from "@bedrock-layout/grid"; import { PadBox } from "@bedrock-layout/padbox"; import { useDispatch, useSelector } from "react-redux"; -import { workspaceSelector } from "../../../features/workspace/workspaceSelector"; -import { setAnimatedBG } from "../../../features/workspace/workspaceSlice"; +import { workspaceSelector } from "../../../../features/workspace/workspaceSelector"; +import { setAnimatedBG } from "../../../../features/workspace/workspaceSlice"; -import { Toggle } from "../../Common/Inputs/Toggle"; -import { OverlayControl } from "../../OverlayTool"; +import { Toggle } from "../../../Common/Inputs/Toggle"; +import { OverlayControl } from "../../../OverlayTool"; export const WorkspaceControls = () => { const dispatch = useDispatch(); diff --git a/src/components/Workspaces/WorkspaceList/WorkspaceList.tsx b/src/components/Workspaces/WorkspaceList/WorkspaceList.tsx index 8f3e63c..017f5ff 100644 --- a/src/components/Workspaces/WorkspaceList/WorkspaceList.tsx +++ b/src/components/Workspaces/WorkspaceList/WorkspaceList.tsx @@ -5,7 +5,7 @@ import { WorkspaceListBox } from "./styles"; import { Stack } from "@bedrock-layout/stack"; import { MenuItem } from "../../Common/MenuItem.styled"; -import { workspaces } from "../workspaces"; +import { workspaces } from "../../../domain/data/workspaces"; type WorkspaceListProps = { headerOffset?: number, diff --git a/src/components/Workspaces/workspaces.ts b/src/components/Workspaces/workspaces.ts deleted file mode 100644 index d4c8fde..0000000 --- a/src/components/Workspaces/workspaces.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { WorkspaceProperties } from "../../types/state"; - -type WorkspaceObject = { - [id: string]: WorkspaceProperties, -}; -export const workspaces: WorkspaceObject = { - chyronSimple: { - name: "Chyron Simple", - overlayIds: [ - "chyron-simple-full.png", - "chyron-simple-opening-1.png", - "chyron-simple-opening-2.png", - ], - previewWindowDimensions: { - width: 650, - height: 200, - }, - }, -}; - diff --git a/src/domain/data/teams.ts b/src/domain/data/teams.ts new file mode 100644 index 0000000..3e53fec --- /dev/null +++ b/src/domain/data/teams.ts @@ -0,0 +1,420 @@ +import { theme } from "../../shared/theme"; +import { Driver, Team } from "../../types/state"; +import { repeater } from "../../utils/strings"; + +/** + * Do not grab directly! + * 2021 Driver lineup with 2022 newcomers included (Zhou and Albon). + */ +export const teams: {[id: string]: Team} = { + alfaRomeo: { + id: "alfaRomeo", + shortName: "Alfa Romeo", + fullName: "Alfa Romeo F1 Team ORLEN", + nationality: "CHE", + }, + alphaTauri: { + id: "alphaTauri", + shortName: "AlphaTauri", + fullName: "Scuderia AlphaTauri", + nationality: "ITA", + }, + alpine: { + id: "alpine", + shortName: "Alpine", + fullName: "Alpine F1 Team", + nationality: "FRA", + }, + astonMartin: { + id: "astonMartin", + shortName: "Aston Martin", + fullName: "Aston Martin Cognizant Formula One Team", + nationality: "GBR", + }, + ferrari: { + id: "ferrari", + shortName: "Ferrari", + fullName: "Scuderia Ferrari", + nationality: "ITA", + }, + haas: { + id: "haas", + shortName: "Haas F1 Team", + fullName: "Uralkali Haas F1 Team", + nationality: "USA", + }, + mclaren: { + id: "mclaren", + shortName: "McLaren", + fullName: "McLaren F1 Team", + nationality: "GBR", + }, + mercedes: { + id: "mercedes", + shortName: "Mercedes", + fullName: "Mercedes-AMG Petronas Formula One Team", + nationality: "DEU", + }, + redBull: { + id: "redBull", + shortName: "Red Bull Racing", + fullName: "Red Bull Racing", + nationality: "AUT", + }, + williams: { + id: "williams", + shortName: "Williams", + fullName: "Williams Racing", + nationality: "GBR", + }, +}; + +/** + * Do not grab directly! + * 2021 Driver lineup with 2022 newcomers included (Zhou and Albon) + */ +export const drivers: {[lastName: string]: Driver} = { + albon: { + id: "albon", + firstName: "Alex", + lastName: "Albon", + number: 23, + team: teams.williams, + yellowTCam: false, // TBD + initials: "ALB", + nationality: "THA", + }, + alonso: { + id: "alonso", + firstName: "Fernando", + lastName: "Alonso", + number: 14, + team: teams.alpine, + yellowTCam: false, + initials: "ALO", + nationality: "ESP", + }, + bottas: { + id: "bottas", + firstName: "Valtteri", + lastName: "Bottas", + number: 77, + team: teams.mercedes, + yellowTCam: true, + initials: "BOT", + nationality: "FIN", + }, + gasly: { + id: "gasly", + firstName: "Pierre", + lastName: "Gasly", + number: 10, + team: teams.alphaTauri, + yellowTCam: true, + initials: "GAS", + nationality: "FRA", + }, + giovinazzi: { + id: "giovinazzi", + firstName: "Antonio", + lastName: "Giovinazzi", + number: 99, + team: teams.alfaRomeo, + yellowTCam: true, + initials: "GIO", + nationality: "ITA", + }, + hamilton: { + id: "hamilton", + firstName: "Lewis", + lastName: "Hamilton", + number: 44, + team: teams.mercedes, + yellowTCam: false, + initials: "HAM", + nationality: "GBR", + }, + kubica: { + id: "kubica", + firstName: "Robert", + lastName: "Kubica", + number: 88, + team: teams.alfaRomeo, + yellowTCam: false, + initials: "KUB", + nationality: "POL", + }, + latifi: { + id: "latifi", + firstName: "Nicolas", + lastName: "Latifi", + number: 6, + team: teams.williams, + yellowTCam: true, + initials: "LAT", + nationality: "CAN", + }, + leclerc: { + id: "leclerc", + firstName: "Charles", + lastName: "Leclerc", + number: 16, + team: teams.ferrari, + yellowTCam: false, + initials: "LEC", + nationality: "MCO", + }, + mazepin: { + id: "mazepin", + firstName: "Nikita", + lastName: "Mazepin", + number: 9, + team: teams.haas, + yellowTCam: false, + initials: "MAZ", + nationality: "RUS", // RAF SUPPORT MAYBE LATER... + }, + norris: { + id: "norris", + firstName: "Lando", + lastName: "Norris", + number: 4, + team: teams.mclaren, + yellowTCam: true, + initials: "NOR", + nationality: "GBR", + }, + ocon: { + id: "ocon", + firstName: "Esteban", + lastName: "Ocon", + number: 31, + team: teams.alpine, + yellowTCam: true, + initials: "OCO", + nationality: "FRA", + }, + perez: { + id: "perez", + firstName: "Sergio", + lastName: "Pérez", + number: 11, + team: teams.redBull, + yellowTCam: true, + initials: "PER", + nationality: "MEX", + }, + raikkonen: { + id: "raikkonen", + firstName: "Kimi", + lastName: "Räikkönen", + number: 7, + team: teams.alfaRomeo, + yellowTCam: false, + initials: "RAI", + nationality: "FIN", + }, + ricciardo: { + id: "ricciardo", + firstName: "Daniel", + lastName: "Ricciardo", + number: 3, + team: teams.mclaren, + yellowTCam: false, + initials: "RIC", + nationality: "AUS", + }, + russell: { + id: "russell", + firstName: "George", + lastName: "Russell", + number: 63, + team: teams.williams, + yellowTCam: false, + initials: "RUS", + nationality: "GBR", + }, + sainz: { + id: "sainz", + firstName: "Carlos", + lastName: "Sainz", + number: 55, + team: teams.ferrari, + yellowTCam: true, + initials: "SAI", + nationality: "ESP", + }, + schumacher: { + id: "schumacher", + firstName: "Mick", + lastName: "Schumacher", + number: 47, + team: teams.haas, + yellowTCam: true, + initials: "MSC", + nationality: "DEU", + }, + stroll: { + id: "stroll", + firstName: "Lance", + lastName: "Stroll", + number: 18, + team: teams.astonMartin, + yellowTCam: false, + initials: "STR", + nationality: "CAN", + }, + tsunoda: { + id: "tsunoda", + firstName: "Yuki", + lastName: "Tsunoda", + number: 22, + team: teams.alphaTauri, + yellowTCam: false, + initials: "TSU", + nationality: "JPN", + }, + verstappen: { + id: "verstappen", + firstName: "Max", + lastName: "Verstappen", + number: 33, + team: teams.redBull, + yellowTCam: false, + initials: "VER", + nationality: "NLD", + }, + vettel: { + id: "vettel", + firstName: "Sebastian", + lastName: "Vettel", + number: 5, + team: teams.astonMartin, + yellowTCam: true, + initials: "VET", + nationality: "DEU", + }, + zhou: { + id: "zhou", + firstName: "Guanyu", + lastName: "Zhou", + number: 24, + team: teams.alfaRomeo, + yellowTCam: true, + initials: "ZHO", + nationality: "CHN", + }, +}; + +type NumberStyleRule = { + type: "stroke" + color: string, + width: number, +} | { + type: "shadow", + property: string, +}; +export type NumberStyle = { + numberColor: string, + fontFamily: string, + rules: Array, +}; +/** + * Do not grab directly! + */ +export const teamNumberStyles: { [teamId: string]: NumberStyle } = { + alpine: { + numberColor: "#ddffff", + fontFamily: theme.fonts.f1Italic, + rules: [ + { type: "shadow", property: repeater("0 0 0.2em #4B7B9E", 4) }, + { type: "stroke", color: "#000", width: 0.13 }, + { type: "shadow", property: repeater("0 0 0.07em #65A6D6", 2) }, + ], + }, + alfaRomeo: { + numberColor: "#ffe9f4", + fontFamily: theme.fonts.f1Italic, + rules: [ + { type: "shadow", property: repeater("0 0 0.2em #900000", 2) }, + { type: "stroke", color: "#000", width: 0.13 }, + { type: "stroke", color: "#900000", width: 0.05 }, + { type: "shadow", property: "0 0 0.07em #900000" }, + ], + }, + alphaTauri: { + numberColor: "#eff5fc", + fontFamily: theme.fonts.f1Italic, + rules: [ + { type: "stroke", color: "#2b4562", width: 0.03 }, + ], + }, + astonMartin: { + numberColor: "#f9ffff", + fontFamily: theme.fonts.f1Italic, + rules: [ + { type: "shadow", property: repeater("0 0 0.2em #006f62", 4) }, + { type: "stroke", color: "#000", width: 0.13 }, + { type: "stroke", color: "#006f62", width: 0.05 }, + { type: "shadow", property: "0 0 0.07em #006f62" }, + ], + }, + haas: { + numberColor: "#fff", + fontFamily: theme.fonts.f1Italic, + rules: [ + { type: "shadow", property: repeater("0 0 0.2em #fff", 4) }, + { type: "stroke", color: "#000", width: 0.13 }, + { type: "stroke", color: "#999", width: 0.05 }, + { type: "shadow", property: "0 0 0.07em #eee" }, + ], + }, + ferrari: { + numberColor: "#fff5f6", + fontFamily: theme.fonts.f1Italic, + rules: [ + { type: "shadow", property: repeater("0 0 0.2em #dc0000", 2) }, + { type: "stroke", color: "#000", width: 0.13 }, + { type: "stroke", color: "#dc0000", width: 0.05 }, + { type: "shadow", property: "0 0 0.07em #dc0000" }, + ], + }, + mclaren: { + numberColor: "#fdf5f6", + fontFamily: theme.fonts.f1Italic, + rules: [ + { type: "shadow", property: repeater("0 0 0.2em #ffb241", 2) }, + { type: "stroke", color: "#000", width: 0.13 }, + { type: "stroke", color: "#ffb241", width: 0.05 }, + { type: "shadow", property: "0 0 0.07em #ffb241" }, + ], + }, + mercedes: { + numberColor: "#daffff", + fontFamily: theme.fonts.f1Italic, + rules: [ + { type: "shadow", property: repeater("0 0 0.2em #daffff", 4) }, + { type: "stroke", color: "#000", width: 0.13 }, + { type: "stroke", color: "#35dfae", width: 0.05 }, + { type: "shadow", property: repeater("0 0 0.07em #35dfae", 2) }, + ], + }, + redBull: { + numberColor: "#f2f2ff", + fontFamily: theme.fonts.f1Italic, + rules: [ + { type: "shadow", property: repeater("0 0 0.2em #0600ef", 4) }, + { type: "stroke", color: "#000", width: 0.13 }, + { type: "stroke", color: "#ebffff", width: 0 }, + ], + }, + williams: { + numberColor: "#ebffff", + fontFamily: theme.fonts.f1Italic, + rules: [ + { type: "shadow", property: repeater("0 0 0.2em #005aff", 2) }, + { type: "stroke", color: "#000", width: 0.13 }, + { type: "stroke", color: "#ebffff", width: 0 }, + ], + }, +}; diff --git a/src/domain/data/workspaces.ts b/src/domain/data/workspaces.ts new file mode 100644 index 0000000..230462c --- /dev/null +++ b/src/domain/data/workspaces.ts @@ -0,0 +1,54 @@ +import { ReactNode } from "react"; +import { WorkspaceId, WorkspaceProperties } from "../../types/state"; + +// Broadcast Graphics +import { ChyronDriver } from "../../components/BroadcastGraphics/Chyrons/Driver"; +import { AngledFlagWorkSpace } from "../../components/Workspaces/CustomWorkSpaces/AngledFlagWorkSpace"; + +type WorkspaceObject = { + [id: WorkspaceId]: WorkspaceProperties, +}; +export const workspaces: WorkspaceObject = { + chyronDriver: { + name: "Chyron Driver", + overlayIds: [ + "chyron-driver-medium-full-ham.png", + "chyron-driver-medium-full-alo.png", + "chyron-driver-medium-full-lec.png", + "chyron-driver-medium-full-rai.png", + "chyron-driver-medium-full-vet.png", + "chyron-driver-medium-full-per.png", + "chyron-driver-medium-full-msc.png", + "chyron-driver-medium-full-gas-weird.png", + "chyron-driver-medium-full-nor-weird.png", + "chyron-driver-medium-full-lat-no-pos.png", + "chyron-driver-medium-op1-ham.png", + "chyron-driver-medium-op2-ham.png", + "chyron-driver-large-np-tsu.png", + "chyron-driver-large-dnf-ver.png", + ], + previewWindowDimensions: { + width: 750, + height: 200, + }, + }, + angledFlag: { + name: "Angled Flag", + overlayIds: [ + "angled-flag-gbr.png", + ], + previewWindowDimensions: { + width: 500, + height: 500, + }, + }, +}; + +export function fetchBroadcastGraphic(workspaceId: WorkspaceId): ReactNode { + switch(workspaceId) { + case "chyronDriver": return ChyronDriver(); + case "angledFlag": return AngledFlagWorkSpace(); + default: return null; + } +} + diff --git a/src/public/images/flags/AUS.svg b/src/public/images/flags/AUS.svg new file mode 100644 index 0000000..3d1060d --- /dev/null +++ b/src/public/images/flags/AUS.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/public/images/flags/CAN.svg b/src/public/images/flags/CAN.svg new file mode 100644 index 0000000..472c431 --- /dev/null +++ b/src/public/images/flags/CAN.svg @@ -0,0 +1,5 @@ + + Flag of Canada (Pantone colours) + + + diff --git a/src/public/images/flags/CHN.svg b/src/public/images/flags/CHN.svg new file mode 100644 index 0000000..61f4fdc --- /dev/null +++ b/src/public/images/flags/CHN.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/src/public/images/flags/DEU.svg b/src/public/images/flags/DEU.svg new file mode 100644 index 0000000..4a5a153 --- /dev/null +++ b/src/public/images/flags/DEU.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/public/images/flags/ESP.svg b/src/public/images/flags/ESP.svg new file mode 100644 index 0000000..8fda47a --- /dev/null +++ b/src/public/images/flags/ESP.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/public/images/flags/FIN.svg b/src/public/images/flags/FIN.svg new file mode 100644 index 0000000..e7f293b --- /dev/null +++ b/src/public/images/flags/FIN.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/public/images/flags/FRA.svg b/src/public/images/flags/FRA.svg new file mode 100644 index 0000000..3165e37 --- /dev/null +++ b/src/public/images/flags/FRA.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/public/images/flags/GBR.svg b/src/public/images/flags/GBR.svg new file mode 100644 index 0000000..37f96ce --- /dev/null +++ b/src/public/images/flags/GBR.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/src/public/images/flags/ITA.svg b/src/public/images/flags/ITA.svg new file mode 100644 index 0000000..9ee6003 --- /dev/null +++ b/src/public/images/flags/ITA.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/public/images/flags/JPN.svg b/src/public/images/flags/JPN.svg new file mode 100644 index 0000000..8f45475 --- /dev/null +++ b/src/public/images/flags/JPN.svg @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/src/public/images/flags/MCO.svg b/src/public/images/flags/MCO.svg new file mode 100644 index 0000000..797f9f2 --- /dev/null +++ b/src/public/images/flags/MCO.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/public/images/flags/MEX.svg b/src/public/images/flags/MEX.svg new file mode 100644 index 0000000..7a80b6f --- /dev/null +++ b/src/public/images/flags/MEX.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/public/images/flags/NLD.svg b/src/public/images/flags/NLD.svg new file mode 100644 index 0000000..f19bd00 --- /dev/null +++ b/src/public/images/flags/NLD.svg @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/src/public/images/flags/POL.svg b/src/public/images/flags/POL.svg new file mode 100644 index 0000000..b08d025 --- /dev/null +++ b/src/public/images/flags/POL.svg @@ -0,0 +1 @@ + diff --git a/src/public/images/flags/RAF.svg b/src/public/images/flags/RAF.svg new file mode 100644 index 0000000..9c187b0 --- /dev/null +++ b/src/public/images/flags/RAF.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/public/images/flags/RUS.svg b/src/public/images/flags/RUS.svg new file mode 100644 index 0000000..387307f --- /dev/null +++ b/src/public/images/flags/RUS.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/public/images/flags/THA.svg b/src/public/images/flags/THA.svg new file mode 100644 index 0000000..2a9fa1c --- /dev/null +++ b/src/public/images/flags/THA.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/public/images/flags/angled/AUS.svg b/src/public/images/flags/angled/AUS.svg new file mode 100644 index 0000000..5365302 --- /dev/null +++ b/src/public/images/flags/angled/AUS.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/src/public/images/flags/angled/CAN.svg b/src/public/images/flags/angled/CAN.svg new file mode 100644 index 0000000..a476a99 --- /dev/null +++ b/src/public/images/flags/angled/CAN.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/public/images/flags/angled/CHN.svg b/src/public/images/flags/angled/CHN.svg new file mode 100644 index 0000000..a7b1632 --- /dev/null +++ b/src/public/images/flags/angled/CHN.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/public/images/flags/angled/DEU.svg b/src/public/images/flags/angled/DEU.svg new file mode 100644 index 0000000..3e37b0b --- /dev/null +++ b/src/public/images/flags/angled/DEU.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/public/images/flags/angled/ESP.svg b/src/public/images/flags/angled/ESP.svg new file mode 100644 index 0000000..0105dfe --- /dev/null +++ b/src/public/images/flags/angled/ESP.svg @@ -0,0 +1,505 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/public/images/flags/angled/FIN.svg b/src/public/images/flags/angled/FIN.svg new file mode 100644 index 0000000..a164034 --- /dev/null +++ b/src/public/images/flags/angled/FIN.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/src/public/images/flags/angled/FRA.svg b/src/public/images/flags/angled/FRA.svg new file mode 100644 index 0000000..0d76113 --- /dev/null +++ b/src/public/images/flags/angled/FRA.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/public/images/flags/angled/GBR.svg b/src/public/images/flags/angled/GBR.svg new file mode 100644 index 0000000..08940ed --- /dev/null +++ b/src/public/images/flags/angled/GBR.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/public/images/flags/angled/ITA.svg b/src/public/images/flags/angled/ITA.svg new file mode 100644 index 0000000..0ee3c3a --- /dev/null +++ b/src/public/images/flags/angled/ITA.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/public/images/flags/angled/JPN.svg b/src/public/images/flags/angled/JPN.svg new file mode 100644 index 0000000..7454f67 --- /dev/null +++ b/src/public/images/flags/angled/JPN.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/public/images/flags/angled/MCO.svg b/src/public/images/flags/angled/MCO.svg new file mode 100644 index 0000000..2faea09 --- /dev/null +++ b/src/public/images/flags/angled/MCO.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/public/images/flags/angled/MEX.svg b/src/public/images/flags/angled/MEX.svg new file mode 100644 index 0000000..4aead72 --- /dev/null +++ b/src/public/images/flags/angled/MEX.svg @@ -0,0 +1,390 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/public/images/flags/angled/NLD.svg b/src/public/images/flags/angled/NLD.svg new file mode 100644 index 0000000..d28acc5 --- /dev/null +++ b/src/public/images/flags/angled/NLD.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/public/images/flags/angled/POL.svg b/src/public/images/flags/angled/POL.svg new file mode 100644 index 0000000..548d5aa --- /dev/null +++ b/src/public/images/flags/angled/POL.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/public/images/flags/angled/RAF.svg b/src/public/images/flags/angled/RAF.svg new file mode 100644 index 0000000..bba573c --- /dev/null +++ b/src/public/images/flags/angled/RAF.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/public/images/flags/angled/RUS.svg b/src/public/images/flags/angled/RUS.svg new file mode 100644 index 0000000..b714eb1 --- /dev/null +++ b/src/public/images/flags/angled/RUS.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/public/images/flags/angled/THA.svg b/src/public/images/flags/angled/THA.svg new file mode 100644 index 0000000..79bd3d4 --- /dev/null +++ b/src/public/images/flags/angled/THA.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/public/images/overlays/angled-flag-gbr.png b/src/public/images/overlays/angled-flag-gbr.png new file mode 100644 index 0000000..ff16222 Binary files /dev/null and b/src/public/images/overlays/angled-flag-gbr.png differ diff --git a/src/public/images/overlays/chyron-driver-large-dnf-ver.png b/src/public/images/overlays/chyron-driver-large-dnf-ver.png new file mode 100644 index 0000000..39dde74 Binary files /dev/null and b/src/public/images/overlays/chyron-driver-large-dnf-ver.png differ diff --git a/src/public/images/overlays/chyron-driver-large-np-tsu.png b/src/public/images/overlays/chyron-driver-large-np-tsu.png new file mode 100644 index 0000000..8205c62 Binary files /dev/null and b/src/public/images/overlays/chyron-driver-large-np-tsu.png differ diff --git a/src/public/images/overlays/chyron-driver-medium-full-alo.png b/src/public/images/overlays/chyron-driver-medium-full-alo.png new file mode 100644 index 0000000..ebf20a6 Binary files /dev/null and b/src/public/images/overlays/chyron-driver-medium-full-alo.png differ diff --git a/src/public/images/overlays/chyron-driver-medium-full-gas-weird.png b/src/public/images/overlays/chyron-driver-medium-full-gas-weird.png new file mode 100644 index 0000000..cc134da Binary files /dev/null and b/src/public/images/overlays/chyron-driver-medium-full-gas-weird.png differ diff --git a/src/public/images/overlays/chyron-simple-full.png b/src/public/images/overlays/chyron-driver-medium-full-ham.png similarity index 100% rename from src/public/images/overlays/chyron-simple-full.png rename to src/public/images/overlays/chyron-driver-medium-full-ham.png diff --git a/src/public/images/overlays/chyron-driver-medium-full-lat-no-pos.png b/src/public/images/overlays/chyron-driver-medium-full-lat-no-pos.png new file mode 100644 index 0000000..57220fe Binary files /dev/null and b/src/public/images/overlays/chyron-driver-medium-full-lat-no-pos.png differ diff --git a/src/public/images/overlays/chyron-driver-medium-full-lec.png b/src/public/images/overlays/chyron-driver-medium-full-lec.png new file mode 100644 index 0000000..162ee5a Binary files /dev/null and b/src/public/images/overlays/chyron-driver-medium-full-lec.png differ diff --git a/src/public/images/overlays/chyron-driver-medium-full-msc.png b/src/public/images/overlays/chyron-driver-medium-full-msc.png new file mode 100644 index 0000000..61e0829 Binary files /dev/null and b/src/public/images/overlays/chyron-driver-medium-full-msc.png differ diff --git a/src/public/images/overlays/chyron-driver-medium-full-nor-weird.png b/src/public/images/overlays/chyron-driver-medium-full-nor-weird.png new file mode 100644 index 0000000..2a9ab05 Binary files /dev/null and b/src/public/images/overlays/chyron-driver-medium-full-nor-weird.png differ diff --git a/src/public/images/overlays/chyron-driver-medium-full-per.png b/src/public/images/overlays/chyron-driver-medium-full-per.png new file mode 100644 index 0000000..2bee3a0 Binary files /dev/null and b/src/public/images/overlays/chyron-driver-medium-full-per.png differ diff --git a/src/public/images/overlays/chyron-driver-medium-full-rai.png b/src/public/images/overlays/chyron-driver-medium-full-rai.png new file mode 100644 index 0000000..4463f0f Binary files /dev/null and b/src/public/images/overlays/chyron-driver-medium-full-rai.png differ diff --git a/src/public/images/overlays/chyron-driver-medium-full-vet.png b/src/public/images/overlays/chyron-driver-medium-full-vet.png new file mode 100644 index 0000000..288bc2e Binary files /dev/null and b/src/public/images/overlays/chyron-driver-medium-full-vet.png differ diff --git a/src/public/images/overlays/chyron-simple-opening-1.png b/src/public/images/overlays/chyron-driver-medium-op1-ham.png similarity index 100% rename from src/public/images/overlays/chyron-simple-opening-1.png rename to src/public/images/overlays/chyron-driver-medium-op1-ham.png diff --git a/src/public/images/overlays/chyron-simple-opening-2.png b/src/public/images/overlays/chyron-driver-medium-op2-ham.png similarity index 100% rename from src/public/images/overlays/chyron-simple-opening-2.png rename to src/public/images/overlays/chyron-driver-medium-op2-ham.png diff --git a/src/shared/theme.ts b/src/shared/theme.ts index 4ee114a..755e588 100644 --- a/src/shared/theme.ts +++ b/src/shared/theme.ts @@ -20,12 +20,28 @@ export const theme = { faintGrey: "#eee", darkGrey: "#303030", videoFrameBG: "#333", + teams: { + alfaRomeo: "#900000", + alphaTauri: "#2b4562", + alpine: "#0090ff", + astonMartin: "#006f62", + ferrari: "#dc0000", + haas: "#fff", + mclaren: "#ff9800", + mercedes: "#00d2be", + redBull: "#0600ef", + williams: "#005aff", + }, }, design: { button: { borderRadius: "0.25rem", }, }, + graphics: { + medRadius: "11px", + smRadius: "7px", + }, }; export type MainThemeProps = ThemeProps; diff --git a/src/types/state.d.ts b/src/types/state.d.ts index de6fb3f..0b6e997 100644 --- a/src/types/state.d.ts +++ b/src/types/state.d.ts @@ -1,43 +1,166 @@ -export type RootState = { - pageDimensions: PageDimensions, - workspace: Workspace, - overlayTool: OverlayTool, -}; +export interface RootState { + pageDimensions: PageDimensions; + workspace: Workspace; + overlayTool: OverlayTool; +} // Page Dimensions -export type PageDimensions = { - mainMenu: Dimensions, - app: Dimensions, - workspace: Dimensions, -}; -export type Dimensions = { width: number, height: number }; +export interface PageDimensions { + mainMenu: Dimensions; + app: Dimensions; + workspace: Dimensions; +} +export interface Dimensions { width: number; height: number; } // Workspace -export type Workspace = { - workspaceId: WorkspaceId, - animatedBG: boolean, - workspaceProperties: WorkspaceProperties, -}; +export interface Workspace { + workspaceId: WorkspaceId; + animatedBG: boolean; + workspaceProperties: WorkspaceProperties; +} export type WorkspaceId = string; -export type WorkspaceProperties = { - name: string, - overlayIds: OverlayIds, - previewWindowDimensions: Dimensions, -}; +export interface WorkspaceProperties { + name: string; + overlayIds: OverlayIds; + previewWindowDimensions: Dimensions; +} // Overlay Tool -export type OverlayTool = { - currentWorkspaceId: WorkspaceId, - overlayIds: OverlayIds, - currentOverlayId: OverlayId | null, - currentOverlayItem: OverlayItem | null, - visible: boolean, -}; +export interface OverlayTool { + currentWorkspaceId: WorkspaceId; + overlayIds: OverlayIds; + currentOverlayId: OverlayId | null; + currentOverlayItem: OverlayItem | null; + visible: boolean; +} export type OverlayId = string; export type OverlayIds = Array; -export type OverlayPosition = { x: number, y: number }; -export type OverlayItem = { - position: OverlayPosition, - opacity: number, -}; +export interface OverlayPosition { x: number; y: number; } +export interface OverlayItem { + position: OverlayPosition; + opacity: number; +} + +// Race State. +export interface Car { + position: number; + driver: Driver; + // status: ???; + // distance: number; +} +export type Grid = Array; +export interface Driver { + id: DriverId; + firstName: string; + lastName: string; + number: number; + team: Team; + yellowTCam: boolean; + initials: string; + nationality: string; // ISO 3166-1 alpha-3 codes +} +export type DriverId = + | "albon" + | "alonso" + | "bottas" + | "gasly" + | "giovinazzi" + | "hamilton" + | "kubica" + | "latifi" + | "leclerc" + | "mazepin" + | "norris" + | "ocon" + | "perez" + | "raikkonen" + | "ricciardo" + | "russell" + | "sainz" + | "schumacher" + | "stroll" + | "tsunoda" + | "verstappen" + | "vettel" + | "zhou"; + +export interface Team { + id: TeamId; + shortName: TeamShortName; + fullName: TeamFullName; + nationality: string; // ISO 3166-1 alpha-3 codes + // logo: string; +} +export type TeamId = + | "alfaRomeo" + | "alphaTauri" + | "alpine" + | "astonMartin" + | "ferrari" + | "haas" + | "mclaren" + | "mercedes" + | "redBull" + | "williams"; +export type TeamShortName = + | "Alfa Romeo" + | "AlphaTauri" + | "Alpine" + | "Aston Martin" + | "Ferrari" + | "Haas F1 Team" + | "McLaren" + | "Mercedes" + | "Red Bull Racing" + | "Williams"; +export type TeamFullName = + | "Alfa Romeo F1 Team ORLEN" + | "Scuderia AlphaTauri" + | "Alpine F1 Team" + | "Aston Martin Cognizant Formula One Team" + | "Scuderia Ferrari" + | "Uralkali Haas F1 Team" + | "McLaren F1 Team" + | "Mercedes-AMG Petronas Formula One Team" + | "Red Bull Racing" + | "Williams Racing"; + +// Broadcast Graphics +export interface BGRelativePos { + top?: string; + right?: string; + bottom?: string; + left?: string; +} +export interface BroadcastGraphics { + // timingBoard: BGTimingBoard; + // statusIndicator: BGStatusIndicator; + // indicators: BGIndicators + chyrons: BGChyrons; + // gems: BGGems + // toasts: BGToasts; +} + +export interface BGChyrons { + primary: BGChyron; + secondary: BGChyron; + // sponsorGem: BGSponsorGem; +} + +export type FlagMode = "country" | "team"; +export type BGChyronMode = + | "driver-basic-small" + | "driver-basic-medium" + | "driver-basic-large"; +export interface BGChyron extends BGRelativePos { + mode: BGChyronMode; + cars: Array; +} +export interface BGChyronMedium extends BGChyron { + mode: "driver-basic-medium"; + flag: FlagMode; + showPosFlag: boolean; + showDriverNumber: boolean; +} + diff --git a/src/types/style.d.ts b/src/types/style.d.ts new file mode 100644 index 0000000..da7c5af --- /dev/null +++ b/src/types/style.d.ts @@ -0,0 +1,4 @@ +/** + * Type to remind you that we're dealing with pixels. + */ +export type Px = number; diff --git a/src/utils/dataLookup.ts b/src/utils/dataLookup.ts new file mode 100644 index 0000000..6731b3c --- /dev/null +++ b/src/utils/dataLookup.ts @@ -0,0 +1,21 @@ +import { drivers, teams, teamNumberStyles, NumberStyle } from "../domain/data/teams"; +import { Driver, DriverId, Team, TeamId } from "../types/state"; + +/** + * Prefer getting data from teams.ts through these simple getter functions. + * Why? Because we cannot use type literals (such as TeamId) as keys in an + * object in TypeScript. This allows me to enforce some type checking in a + * situation I wouldn't be able to normally + */ + +export function getDriver(driverId: DriverId): Driver { + return drivers[driverId]; +} + +export function getTeam(teamId: TeamId): Team { + return teams[teamId]; +} + +export function getTeamNumberStyle(teamId: TeamId): NumberStyle { + return teamNumberStyles[teamId]; +} diff --git a/src/utils/strings.spec.ts b/src/utils/strings.spec.ts index d7c4935..85bacc9 100644 --- a/src/utils/strings.spec.ts +++ b/src/utils/strings.spec.ts @@ -1,4 +1,4 @@ -import { findPrefixCount } from "./strings"; +import { findPrefixCount, repeater } from "./strings"; describe("strings", () => { describe("findPrefixCount", () => { @@ -41,7 +41,7 @@ describe("strings", () => { "Hello", ], true)).toBe(1); }); - it("is correctly case-insensitive", () => { + it("is case-insensitive", () => { expect(findPrefixCount([ "Hello", "HELLO", @@ -50,4 +50,51 @@ describe("strings", () => { }); }); }); + + describe("repeater", () => { + describe("repeats correctly", () => { + it("repeats 1 time", () => { + expect(repeater( + "A", + 1, + ",", + )).toBe("A"); + }); + it("repeats 3 times", () => { + expect(repeater( + "A", + 3, + ",", + )).toBe("A,A,A"); + }); + it("correctly handles 0", () => { + expect(repeater( + "A", + 0, + ",", + )).toBe(""); + }); + it("correctly handles -1", () => { + expect(repeater( + "A", + -1, + ",", + )).toBe(""); + }); + it("correctly handles blank delimiter", () => { + expect(repeater( + "A", + 3, + "", + )).toBe("AAA"); + }); + it("correctly handles different delimiter", () => { + expect(repeater( + "A", + 3, + " + ", + )).toBe("A + A + A"); + }); + }); + }); }); diff --git a/src/utils/strings.ts b/src/utils/strings.ts index 19652ba..76b8b6a 100644 --- a/src/utils/strings.ts +++ b/src/utils/strings.ts @@ -23,3 +23,22 @@ export function findPrefixCount(strings: Array, caseSensitive = true): n } return maskLength; } + +/** + * Basic function repeats the given string a set number of times and allows for + * a delimiter. + * @param value the string to repeat + * @param count the number of times to repeat + * @param delimiter the string to place between repeated strings + * @returns + */ +export function repeater(value: string, count: number, delimiter = ", "): string { + let output = ""; + for (let x = 0; x < count; ++x) { + output += value; + if (delimiter.length !== 0 && x < count - 1) { + output += delimiter; + } + } + return output; +}