ISSUE-062 - Lap indicator now looking good and animating well.
New scheduled lap event state. New alternative white color that matches what's seen in reality. New overlay for wide lap indicator.
This commit is contained in:
1 parent
d2e4afb975
commit
1af134b9a4
9 files changed
+179
-17
No files matched your search
@@ -1,14 +1,18 @@
|
||||
import { useSelector } from "react-redux";
|
||||
|
||||
import { broadcastGraphicsSelector } from "../../../../features/broadcast/graphics/broadcastGraphicsSelector";
|
||||
import { eventSelector } from "../../../../features/event/eventSelector";
|
||||
import { theme } from "../../../../shared/theme";
|
||||
import { BGStatusIndicatorModes } from "../../../../types/state";
|
||||
import { DebugDurationProps } from "../../../../types/style";
|
||||
import { DebugDurationProps, TransitionArgs } from "../../../../types/style";
|
||||
import { orMatch } from "../../../../utils/common";
|
||||
|
||||
import { StatusIndicatorBase } from "./styles";
|
||||
import { LapCount, LapLabel, LapLine, StatusIndicatorBase, StatusIndicatorLayout } from "./styles";
|
||||
|
||||
type StatusIndicatorProps = DebugDurationProps;
|
||||
|
||||
|
||||
|
||||
export function StatusIndicator({
|
||||
debugDurationMultiplier: DDM = 1.0,
|
||||
}: StatusIndicatorProps) {
|
||||
@@ -16,19 +20,56 @@ export function StatusIndicator({
|
||||
|
||||
const { timingBoard: { statusIndicator: { mode } } } =
|
||||
useSelector(broadcastGraphicsSelector);
|
||||
const { progress: { scheduledLaps, lapCount } } = useSelector(eventSelector);
|
||||
|
||||
const toWideTransition: TransitionArgs[] = [{
|
||||
property: "all",
|
||||
duration: ttTheme.fullWidthDurationMs * DDM,
|
||||
}];
|
||||
const toNarrowTransition: TransitionArgs[] = [{
|
||||
property: "all",
|
||||
duration: ttTheme.fullWidthDurationMs * DDM,
|
||||
delay: ttTheme.fullWidthCloseDelayMs * DDM,
|
||||
}];
|
||||
|
||||
return (
|
||||
<StatusIndicatorBase
|
||||
open={mode !== BGStatusIndicatorModes.LapNarrow}
|
||||
transitionOpeningProps={[{
|
||||
property: "width",
|
||||
duration: ttTheme.fullWidthDurationMs * DDM,
|
||||
}]}
|
||||
transitionClosingProps={[{
|
||||
property: "width",
|
||||
duration: ttTheme.fullWidthDurationMs * DDM,
|
||||
delay: ttTheme.fullWidthCloseDelayMs * DDM,
|
||||
}]}
|
||||
/>
|
||||
transitionOpeningProps={toWideTransition}
|
||||
transitionClosingProps={toNarrowTransition}
|
||||
>
|
||||
<StatusIndicatorLayout>
|
||||
{orMatch(mode, BGStatusIndicatorModes.LapNarrow, BGStatusIndicatorModes.LapWide) && (
|
||||
<>
|
||||
<LapLine
|
||||
mode={BGStatusIndicatorModes.LapNarrow}
|
||||
open={mode === BGStatusIndicatorModes.LapNarrow}
|
||||
transitionOpeningProps={toNarrowTransition}
|
||||
transitionClosingProps={toWideTransition}
|
||||
/>
|
||||
<LapLine
|
||||
mode={BGStatusIndicatorModes.LapWide}
|
||||
open={mode === BGStatusIndicatorModes.LapWide}
|
||||
transitionOpeningProps={toWideTransition}
|
||||
transitionClosingProps={toNarrowTransition}
|
||||
/>
|
||||
<LapLabel
|
||||
mode={mode}
|
||||
open={mode === BGStatusIndicatorModes.LapWide}
|
||||
transitionOpeningProps={toWideTransition}
|
||||
transitionClosingProps={toNarrowTransition}
|
||||
>LAP</LapLabel>
|
||||
<LapCount
|
||||
mode={mode}
|
||||
open={mode === BGStatusIndicatorModes.LapWide}
|
||||
transitionOpeningProps={toWideTransition}
|
||||
transitionClosingProps={toNarrowTransition}
|
||||
>
|
||||
<span>{lapCount} / {scheduledLaps}</span>
|
||||
</LapCount>
|
||||
</>
|
||||
)}
|
||||
</StatusIndicatorLayout>
|
||||
</StatusIndicatorBase>
|
||||
);
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import styled from "styled-components";
|
||||
import { BGStatusIndicatorModes } from "../../../../types/state";
|
||||
|
||||
import { DirectionalTransitionProps } from "../../../../types/style";
|
||||
import { commonDirectionalTransition } from "../../../../utils/styling";
|
||||
@@ -15,3 +16,105 @@ export const StatusIndicatorBase = styled.div<DirectionalTransitionProps>`
|
||||
commonDirectionalTransition(open, transitionOpeningProps, transitionClosingProps, transitionProps)}
|
||||
`;
|
||||
StatusIndicatorBase.displayName = "StatusIndicatorBase";
|
||||
|
||||
|
||||
export const StatusIndicatorLayout = styled.div`
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
`;
|
||||
StatusIndicatorLayout.displayName = "StatusIndicatorLayout";
|
||||
|
||||
type IndicatorModeProps = {
|
||||
mode: BGStatusIndicatorModes,
|
||||
};
|
||||
|
||||
|
||||
////// Lap Indicator Mode Styles //////
|
||||
type LapLineProps = DirectionalTransitionProps & IndicatorModeProps;
|
||||
export const LapLine = styled.div<LapLineProps>`
|
||||
position: absolute;
|
||||
top: ${({ mode }) =>
|
||||
mode === BGStatusIndicatorModes.LapNarrow
|
||||
? 33 : mode === BGStatusIndicatorModes.LapWide ? 5 : 0}px;
|
||||
left: ${({ mode }) =>
|
||||
mode === BGStatusIndicatorModes.LapNarrow
|
||||
? 30 : mode === BGStatusIndicatorModes.LapWide ? 128 : 0}px;
|
||||
|
||||
opacity: ${({ open }) => open ? 1 : 0};
|
||||
|
||||
width: ${({ mode, open }) =>
|
||||
mode === BGStatusIndicatorModes.LapNarrow
|
||||
? (90 * (open ? 1 : 0.3)) : mode === BGStatusIndicatorModes.LapWide ? 3 : 0}px;
|
||||
height: ${({ mode, open }) =>
|
||||
mode === BGStatusIndicatorModes.LapNarrow
|
||||
? 3 : mode === BGStatusIndicatorModes.LapWide ? (60 * (open ? 1 : 0.3)) : 0}px;
|
||||
|
||||
background-color: ${p => p.theme.colors.textWhite};
|
||||
border: 1px solid ${p => p.theme.colors.dimGrey};
|
||||
mask-image: linear-gradient(
|
||||
to ${({ mode }) => mode === BGStatusIndicatorModes.LapNarrow ? "left" : "bottom"},
|
||||
transparent 0,
|
||||
#000000cc 40%,
|
||||
#000000cc 50%,
|
||||
#000000cc 60%,
|
||||
transparent 100%
|
||||
);
|
||||
|
||||
${({ open, transitionOpeningProps, transitionClosingProps, transitionProps }) =>
|
||||
commonDirectionalTransition(open, transitionOpeningProps, transitionClosingProps, transitionProps)}
|
||||
`;
|
||||
LapLine.displayName = "LapLine";
|
||||
|
||||
|
||||
type LapLabelProps = DirectionalTransitionProps & IndicatorModeProps;
|
||||
export const LapLabel = styled.span<LapLabelProps>`
|
||||
position: absolute;
|
||||
top: ${({ mode }) =>
|
||||
mode === BGStatusIndicatorModes.LapNarrow
|
||||
? 6 : mode === BGStatusIndicatorModes.LapWide ? 22 : 0}px;
|
||||
left: ${({ mode }) =>
|
||||
mode === BGStatusIndicatorModes.LapNarrow
|
||||
? 33 : mode === BGStatusIndicatorModes.LapWide ? 25 : 0}px;
|
||||
|
||||
font-family: ${p => p.theme.fonts.f1Wide};
|
||||
font-size: ${p => p.theme.fontSizes.indicatorLapLabel};
|
||||
color: ${p => p.theme.colors.textWhite};
|
||||
|
||||
${({ open, transitionOpeningProps, transitionClosingProps, transitionProps }) =>
|
||||
commonDirectionalTransition(open, transitionOpeningProps, transitionClosingProps, transitionProps)}
|
||||
`;
|
||||
LapLabel.displayName = "LapLabel";
|
||||
|
||||
|
||||
type LapCountProps = DirectionalTransitionProps & IndicatorModeProps;
|
||||
export const LapCount = styled.div<LapCountProps>`
|
||||
position: absolute;
|
||||
top: ${({ mode }) =>
|
||||
mode === BGStatusIndicatorModes.LapNarrow
|
||||
? 41 : mode === BGStatusIndicatorModes.LapWide ? 24 : 0}px;
|
||||
left: ${({ mode }) =>
|
||||
mode === BGStatusIndicatorModes.LapNarrow
|
||||
? 72 : mode === BGStatusIndicatorModes.LapWide ? 185 : 0}px;
|
||||
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
width: 0;
|
||||
height: ${p => p.theme.fontSizes.indicatorLapCount};
|
||||
overflow-y: clip;
|
||||
|
||||
> span {
|
||||
font-family: ${p => p.theme.fonts.f1Regular};
|
||||
font-size: ${p => p.theme.fontSizes.indicatorLapCount};
|
||||
color: ${p => p.theme.colors.textWhite};
|
||||
|
||||
font-feature-settings: 'tnum' 1;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
${({ open, transitionOpeningProps, transitionClosingProps, transitionProps }) =>
|
||||
commonDirectionalTransition(open, transitionOpeningProps, transitionClosingProps, transitionProps)}
|
||||
`;
|
||||
LapCount.displayName = "LapCount";
|
||||
Reference in new issue
Block a user