diff --git a/src/components/BroadcastGraphics/Common/AngledFlag/styles.ts b/src/components/BroadcastGraphics/Common/AngledFlag/styles.ts index 763873a..1d3012c 100644 --- a/src/components/BroadcastGraphics/Common/AngledFlag/styles.ts +++ b/src/components/BroadcastGraphics/Common/AngledFlag/styles.ts @@ -98,7 +98,7 @@ type TeamFlagDivProps = { style: TeamFlagStyle, bottomFlag?: boolean, }; -export const TeamFlagDiv = styled(FlagDivBase) ` +export const TeamFlagDiv = styled(FlagDivBase)` height: ${({ height }) => `${height}px`}; width: ${({ width }) => `${width}px`}; diff --git a/src/components/BroadcastGraphics/Common/PositionFlag/PositionFlag.tsx b/src/components/BroadcastGraphics/Common/PositionFlag/PositionFlag.tsx index 7903f6a..e70f099 100644 --- a/src/components/BroadcastGraphics/Common/PositionFlag/PositionFlag.tsx +++ b/src/components/BroadcastGraphics/Common/PositionFlag/PositionFlag.tsx @@ -1,15 +1,16 @@ -import { Px } from "../../../../types/style"; +import { Fraction, Px } from "../../../../types/style"; import { PositionFlagBox, PositionNumber } from "./styles"; type PositionFlagProps = { size: Px, number: number, + numberSizeFraction?: Fraction, }; -export function PositionFlag({ size, number }: PositionFlagProps) { +export function PositionFlag({ size, number, numberSizeFraction = 0.64 }: PositionFlagProps) { return ( - + {number} diff --git a/src/components/BroadcastGraphics/Common/PositionFlag/styles.ts b/src/components/BroadcastGraphics/Common/PositionFlag/styles.ts index d9cfbbe..e9ffc4c 100644 --- a/src/components/BroadcastGraphics/Common/PositionFlag/styles.ts +++ b/src/components/BroadcastGraphics/Common/PositionFlag/styles.ts @@ -23,7 +23,7 @@ type PositionNumberProps = { }; export const PositionNumber = styled.span` font-family: ${p => p.theme.fonts.f1Regular}; - font-size: ${({ size }) => `${size * 0.64}px`}; + font-size: ${({ size }) => size}px; margin-top: 2px; `; PositionNumber.displayName = "PositionNumber"; diff --git a/src/components/BroadcastGraphics/Common/TeamGem/TeamGem.tsx b/src/components/BroadcastGraphics/Common/TeamGem/TeamGem.tsx new file mode 100644 index 0000000..c567b1a --- /dev/null +++ b/src/components/BroadcastGraphics/Common/TeamGem/TeamGem.tsx @@ -0,0 +1,26 @@ +import { TeamId } from "../../../../types/state"; +import { Px } from "../../../../types/style"; +import { getTeamGemStyle } from "../../../../utils/dataLookup"; +import { GemColorDiv, GemContainer, GemLogoDiv } from "./styles"; + +const teamLogos = require.context("../../../../public/images/logos/team", true); + +type TeamGemProps = { + height: Px, + team: TeamId, +}; +export function TeamGem({ height, team }: TeamGemProps) { + return ( + + + + + ); +} diff --git a/src/components/BroadcastGraphics/Common/TeamGem/index.ts b/src/components/BroadcastGraphics/Common/TeamGem/index.ts new file mode 100644 index 0000000..af964e0 --- /dev/null +++ b/src/components/BroadcastGraphics/Common/TeamGem/index.ts @@ -0,0 +1 @@ +export * from "./TeamGem"; diff --git a/src/components/BroadcastGraphics/Common/TeamGem/styles.ts b/src/components/BroadcastGraphics/Common/TeamGem/styles.ts new file mode 100644 index 0000000..02ad60b --- /dev/null +++ b/src/components/BroadcastGraphics/Common/TeamGem/styles.ts @@ -0,0 +1,60 @@ +import styled from "styled-components"; +import { TeamGemStyle } from "../../../../domain/data/teams"; +import { Px } from "../../../../types/style"; + + +const GEM_WIDTH_RATIO = 1.21; + +type GemContainerProps = { + height: Px, +}; +export const GemContainer = styled.div` + position: relative; + height: ${({ height }) => height}px; + width: ${({ height }) => height * GEM_WIDTH_RATIO}px; + + overflow: hidden; + background-color: black; + border-bottom-right-radius: 3px; + + mask-image: linear-gradient(to left, black 0%, black 80%, transparent 100%); + clip-path: polygon(40% 0, 100% 0, 100% 100%, 0 100%, 0 50%); +`; +GemContainer.displayName = "GemContainer"; + +type GemColorDivProps = { + height: Px, + gemStyle: TeamGemStyle, +}; +export const GemColorDiv = styled.div` + position: absolute; + height: 100%; + width: 100%; + + background-image: radial-gradient( + circle at 120% 160%, + ${({ gemStyle: { backgroundColor } }) => backgroundColor} 50%, + black 100% + ); + background-size: 100%; + background-repeat: no-repeat; +`; + +type GemLogoDivProps = { + height: Px, + gemStyle: TeamGemStyle, + src: string, +}; +export const GemLogoDiv = styled.div` + position: absolute; + height: 100%; + width: 100%; + + background-image: url(${({ src }) => src}); + background-size: ${({ gemStyle: { imageSize } }) => imageSize}%; + background-position: ${({ height, gemStyle: { imagePos: { x, y } } }) => ( + `${height * GEM_WIDTH_RATIO * x}px ${height * y}px` + )}; + background-repeat: no-repeat; +`; +GemLogoDiv.displayName = "GemDiv"; diff --git a/src/components/BroadcastGraphics/TimingBoard/TimingTower/TimingTower.tsx b/src/components/BroadcastGraphics/TimingBoard/TimingTower/TimingTower.tsx index 9bbb9df..cab353d 100644 --- a/src/components/BroadcastGraphics/TimingBoard/TimingTower/TimingTower.tsx +++ b/src/components/BroadcastGraphics/TimingBoard/TimingTower/TimingTower.tsx @@ -8,12 +8,13 @@ import { orMatch } from "../../../../utils/common"; import { timeDiff } from "../../../../utils/event"; import { formatTime } from "../../../../utils/styling"; import { PositionFlag } from "../../Common/PositionFlag"; -import { Spacer } from "../../Common/Spacer.styled"; +import { TeamGem } from "../../Common/TeamGem"; import { DriverName, RowContainer, RowLeftHalf, + RowLeftHalfGemContainer, RowLeftHalfLayout, RowRightHalf, RowRightHalfLayout, @@ -35,7 +36,7 @@ export function TimingTower({ const retiredCars: Car[] = []; grid.forEach((car, index) => { - if (index >= carsToDisplay) return; + if (index >= carsToDisplay || car.status === CarStatus.DidNotStart) return; if (car.status === CarStatus.Retired) { retiredCars.push(car); } else { @@ -54,6 +55,7 @@ export function TimingTower({ const lastRow = index + 1 === count; let rightHalfContent = ""; let xScale: Fraction = 1.0; + let yScale: Fraction = 1.0; let leader = false; if (forwardCarDistance === -1) { @@ -72,6 +74,7 @@ export function TimingTower({ car.distance, ), 60)}`; xScale = rightHalfContent.includes(".") && rightHalfContent.length > 7 ? 0.75 : 0.9; + yScale = rightHalfContent.includes(".") ? 1.1 : 1.0; } if (timingBoard.timingTower.mode === BGTimingTowerModes.Interval) { @@ -95,18 +98,20 @@ export function TimingTower({ } > - {car.status !== CarStatus.Retired && ( )} - {car.driver.initials} + + + - + {rightHalfContent} diff --git a/src/components/BroadcastGraphics/TimingBoard/TimingTower/styles.ts b/src/components/BroadcastGraphics/TimingBoard/TimingTower/styles.ts index 8c77ca8..8aa7ad2 100644 --- a/src/components/BroadcastGraphics/TimingBoard/TimingTower/styles.ts +++ b/src/components/BroadcastGraphics/TimingBoard/TimingTower/styles.ts @@ -2,6 +2,8 @@ import styled, { css } from "styled-components"; import { Fraction, Px } from "../../../../types/style"; +const ROW_HEIGHT = 36.5; + export const RowsContainer = styled.div` display: flex; flex-direction: column; @@ -11,7 +13,7 @@ flex-wrap: nowrap; justify-content: flex-start; align-items: stretch; `; - +RowsContainer.displayName = "RowsContainer"; type RowContainerProps = { topGap?: boolean, @@ -23,12 +25,13 @@ type RowContainerProps = { export const RowContainer = styled.div` position: relative; width: ${({ wide }) => wide ? 255 : 147}px; - height: 36px; // Future will be animated. + height: ${ROW_HEIGHT}px; // Future will be animated. ${({ topGap }) => topGap && css`margin-top: 3px;`} ${({ bottomGap }) => bottomGap && css`margin-bottom: 3px;`} ${({ retired }) => retired && css`opacity: 0.7;`} `; +RowContainer.displayName = "RowContainer"; type RoundedProp = { roundedCornerTop?: Px, @@ -47,20 +50,32 @@ export const RowLeftHalf = styled(Rounded)` top: 0; width: 147px; // Future will be animated. - height: 36px; + height: ${ROW_HEIGHT}px; background-color: #000000e5 `; +RowLeftHalf.displayName = "RowLeftHalf"; export const RowLeftHalfLayout = styled.div` + position: relative; width: 100%; height: 100%; display: flex; + padding-left: 3px; align-items: center; justify-content: flex-start; `; +RowLeftHalfLayout.displayName = "RowLeftHalfLayout"; + +export const RowLeftHalfGemContainer = styled.div` + position: absolute; + right: 0; + top: 0; + margin-top: 2px; +`; +RowLeftHalfGemContainer.displayName = "RowLeftHalfGemContainer"; export const RowRightHalf = styled(Rounded)` position: absolute; @@ -68,12 +83,13 @@ export const RowRightHalf = styled(Rounded)` top: 0; width: 108px; // Future will be animated. - height: 36px; + height: ${ROW_HEIGHT}px; overflow-x: hidden; background-color: #0000007e `; +RowRightHalf.displayName = "RowRightHalf"; export const RowRightHalfLayout = styled.div` width: 100%; @@ -85,15 +101,19 @@ export const RowRightHalfLayout = styled.div` justify-content: flex-end; padding-right: 8px; `; +RowRightHalfLayout.displayName = "RowRightHalfLayout"; export const DriverName = styled.span` color: white; font-family: ${p => p.theme.fonts.f1Bold}; font-size: 20px; + margin-left: 14px; `; +DriverName.displayName = "DriverName"; type TimeDiffProps = { xScale: Fraction, + yScale: Fraction, }; export const TimeDiff = styled.span` color: white; @@ -103,6 +123,7 @@ export const TimeDiff = styled.span` text-align: end; font-feature-settings: 'tnum' 1; - transform-origin: right; - transform: scaleX(${({ xScale }) => xScale}); + transform-origin: top right; + transform: scale(${({ xScale, yScale }) => `${xScale}, ${yScale}`}); `; +TimeDiff.displayName = "TimeDiff"; diff --git a/src/components/OverlayTool/OverlayDisplay/OverlayDisplay.tsx b/src/components/OverlayTool/OverlayDisplay/OverlayDisplay.tsx index 4a0107d..7046b91 100644 --- a/src/components/OverlayTool/OverlayDisplay/OverlayDisplay.tsx +++ b/src/components/OverlayTool/OverlayDisplay/OverlayDisplay.tsx @@ -5,6 +5,8 @@ import useMeasure from "react-use-measure"; import { overlayToolSelector } from "../../../features/overlayTool/overlayToolSelector"; import { setPosition } from "../../../features/overlayTool/overlayToolSlice"; +import { Px } from "../../../types/style"; + import { OverlayImage, OverlayImageContainer, @@ -16,10 +18,10 @@ const overlayImages = require.context("../../../public/images/overlays", true); type OverlayDisplayProps = { containerDimensions: { - width: number, - height: number, + width: Px, + height: Px, }, - bleedover?: number, + bleedover?: Px, }; export function OverlayDisplay({ containerDimensions: { width: containerWidth, height: containerHeight }, diff --git a/src/components/Workspaces/WorkspacesRoute.tsx b/src/components/Workspaces/WorkspacesRoute.tsx index 69bcc18..c593be6 100644 --- a/src/components/Workspaces/WorkspacesRoute.tsx +++ b/src/components/Workspaces/WorkspacesRoute.tsx @@ -103,6 +103,7 @@ export default function Workspaces() { workspaceId="timingBoardShort" previewContent={} prototypeControls={
Timing Tower Short
} + bleedover={250} /> } /> Unknown Workspace} /> diff --git a/src/domain/data/teams.ts b/src/domain/data/teams.ts index bee40f2..65ef0ec 100644 --- a/src/domain/data/teams.ts +++ b/src/domain/data/teams.ts @@ -496,3 +496,64 @@ export const teamFlagStyles: { [teamId: string]: TeamFlagStyle } = { subFlagModifier: { x: 1, y: 1, scale: .98 }, }, }; + +export type TeamGemStyle = { + backgroundColor: string, + imageSize: Percent, + imagePos: { + x: number, + y: number, + }, +}; +export const teamGemStyles: { [teamId: string]: TeamGemStyle } = { + alfaRomeo: { + backgroundColor: "#660000", + imageSize: 65, + imagePos: { x: .28, y: .15 }, + }, + alphaTauri: { + backgroundColor: "#232c3b", + imageSize: 75, + imagePos: { x: .26, y: .07 }, + }, + alpine: { + backgroundColor: "black", + imageSize: 82, + imagePos: { x: .13, y: 0 }, + }, + astonMartin: { + backgroundColor: "#037356", + imageSize: 130, + imagePos: { x: .05, y: -.22 }, + }, + ferrari: { + backgroundColor: "#dc0000", + imageSize: 65, + imagePos: { x: .3, y: .18 }, + }, + haas: { + backgroundColor: "#f0f0f0", + imageSize: 65, + imagePos: { x: .25, y: .12 }, + }, + mclaren: { + backgroundColor: "#545459", + imageSize: 67, + imagePos: { x: .25, y: .1 }, + }, + mercedes: { + backgroundColor: "#1ee0ad", + imageSize: 63, + imagePos: { x: .31, y: .16 }, + }, + redBull: { + backgroundColor: "#413ae2", + imageSize: 130, + imagePos: { x: .20, y: .05 }, + }, + williams: { + backgroundColor: "#12a0cb", + imageSize: 65, + imagePos: { x: .3, y: .12 }, + }, +}; diff --git a/src/utils/dataLookup.ts b/src/utils/dataLookup.ts index 469ebeb..f39b9b9 100644 --- a/src/utils/dataLookup.ts +++ b/src/utils/dataLookup.ts @@ -1,6 +1,6 @@ import { cloneDeep } from "lodash"; -import { drivers, teams, teamNumberStyles, teamFlagStyles } from "../domain/data/teams"; -import { DriverId, TeamId } from "../types/state"; +import { drivers, teams, teamNumberStyles, teamFlagStyles, teamGemStyles } from "../domain/data/teams"; +import { DriverId, Team, TeamId } from "../types/state"; /** * Prefer getting data from teams.ts through these simple getter functions. @@ -29,3 +29,6 @@ export function getTeamNumberStyle(teamId: TeamId) { export function getTeamFlagStyle(teamId: TeamId) { return teamFlagStyles[teamId]; } +export function getTeamGemStyle(teamId: TeamId) { + return teamGemStyles[teamId]; +}