ISSUE-069 - Toast FL gem implemented.
Appears to be a possible alignment issue with the PosFlag component - I think a margin above the component is missing. Will look into it.
This commit is contained in:
1 parent
aa0e20e8ce
commit
de03f24b70
6 files changed
+58
-21
No files matched your search
@@ -13,7 +13,7 @@ export function PositionFlag({
|
||||
size,
|
||||
number,
|
||||
numberSizeFraction = 0.64,
|
||||
color = theme.colors.positionFlagBG,
|
||||
color = theme.colors.posWhite,
|
||||
}: PositionFlagProps) {
|
||||
return (
|
||||
<PositionFlagBox size={size} color={color}>
|
||||
|
||||
@@ -36,6 +36,7 @@ import {
|
||||
AnimatedRowLeftHalfOutline,
|
||||
DriverNameContainer,
|
||||
DriverNameWipe,
|
||||
FastestLapContainer,
|
||||
} from "./styles";
|
||||
import useMeasure from "react-use-measure";
|
||||
|
||||
@@ -62,27 +63,28 @@ export function TimingTowerRow({
|
||||
|
||||
const [pastPos, setPastPos] = useState(car.position);
|
||||
const [posChange, setPosChange] = useState(0);
|
||||
const [pastFLHolder, setPastFLHolder] = useState(false);
|
||||
const [pastDisplayMode, setPastDisplayMode] = useState(displayMode);
|
||||
const [hugRight, setHugRight] = useState(true);
|
||||
|
||||
// Using timeouts and boolean states I can manipulate visiblity of the position
|
||||
// change effects. wipeVisible is true for only 1ms before being switched back off.
|
||||
const [showPosChange, setShowPosChange] = useState(false);
|
||||
// change effects. showPosWipe is true for only 1ms before being switched back off.
|
||||
const [showPosOutline, setShowPosOutline] = useState(false);
|
||||
const [showOutline, setShowOutline] = useState(false);
|
||||
const [wipeVisible, setWipeVisible] = useState(false);
|
||||
useTimeoutWhen(() => setShowPosChange(false), (
|
||||
const [showPosWipe, setShowPosWipe] = useState(false);
|
||||
useTimeoutWhen(() => setShowPosOutline(false), (
|
||||
ttTheme.wipeDelayMs + ttTheme.wipeDurationMs
|
||||
) * DDM, showPosChange);
|
||||
) * DDM, showPosOutline);
|
||||
useTimeoutWhen(() => setShowOutline(false), ttTheme.rowTravelDurationMs * DDM, showOutline);
|
||||
useTimeoutWhen(() => setWipeVisible(false), 1, wipeVisible);
|
||||
useTimeoutWhen(() => setShowPosWipe(false), 1, showPosWipe);
|
||||
|
||||
useEffect(() => {
|
||||
if (car.position !== pastPos) {
|
||||
setPastPos(car.position);
|
||||
setPosChange(pastPos - car.position);
|
||||
setShowPosChange(true);
|
||||
setShowPosOutline(true);
|
||||
setShowOutline(true);
|
||||
setWipeVisible(true);
|
||||
setShowPosWipe(true);
|
||||
}
|
||||
}, [car.position]);
|
||||
|
||||
@@ -103,7 +105,7 @@ export function TimingTowerRow({
|
||||
}, [displayMode]);
|
||||
|
||||
const { outlineClipPathProgress } = useSpring({
|
||||
outlineClipPathProgress: showPosChange ? 1 : 0,
|
||||
outlineClipPathProgress: showPosOutline ? 1 : 0,
|
||||
config: { duration: 333 * DDM },
|
||||
delay: 0 * DDM,
|
||||
});
|
||||
@@ -154,9 +156,15 @@ export function TimingTowerRow({
|
||||
top={(car.position - 1) * ttTheme.rowHeightPx}
|
||||
transitionTime={ttTheme.rowTravelDurationMs * DDM}
|
||||
>
|
||||
{car.notices.includes(CarNotice.FastestLap) && (
|
||||
<FastestLapGem />
|
||||
)}
|
||||
<FastestLapContainer>
|
||||
<FastestLapGem
|
||||
open={car.notices.includes(CarNotice.FastestLap)}
|
||||
transitionProps={[{
|
||||
property: "left",
|
||||
duration: ttTheme.fastestLapToastDurationMs * DDM,
|
||||
}]}
|
||||
/>
|
||||
</FastestLapContainer>
|
||||
<RowLeftHalf
|
||||
roundedCornerBottom={
|
||||
bottomRounded && orMatch(
|
||||
@@ -201,12 +209,12 @@ export function TimingTowerRow({
|
||||
/>
|
||||
<RowLeftHalfPosFlagChangeContainer
|
||||
size={ttTheme.posFlagSizePx}
|
||||
visible={showPosChange}
|
||||
visible={showPosOutline}
|
||||
transitionTime={167 * DDM}
|
||||
>
|
||||
{showPosChange && (
|
||||
{(showPosOutline) && (
|
||||
<WipeTransition
|
||||
visible={wipeVisible}
|
||||
visible={showPosWipe}
|
||||
delay={ttTheme.wipeDelayMs * DDM}
|
||||
angle={45}
|
||||
duration={ttTheme.wipeDurationMs * DDM}
|
||||
|
||||
@@ -5,9 +5,10 @@ import {
|
||||
Fraction,
|
||||
Px,
|
||||
DirectionalTransitionProps,
|
||||
TransitionProps,
|
||||
} from "../../../../types/style";
|
||||
import { Milliseconds } from "../../../../types/util";
|
||||
import { commonDirectionalTransition } from "../../../../utils/styling";
|
||||
import { commonDirectionalTransition, commonTransition } from "../../../../utils/styling";
|
||||
|
||||
import fastestLapIcon from "../../../../public/images/icons/fastest-lap.svg";
|
||||
|
||||
@@ -251,19 +252,32 @@ export const TimeDiff = styled.span<TimeDiffProps>`
|
||||
`;
|
||||
TimeDiff.displayName = "TimeDiff";
|
||||
|
||||
export const FastestLapGem = styled.div`
|
||||
export const FastestLapContainer = styled.div`
|
||||
position: absolute;
|
||||
left: ${p => -p.theme.design.timingTower.rowHeightPx + 2}px;
|
||||
top: 0;
|
||||
|
||||
height: ${p => p.theme.design.timingTower.rowHeightPx}px;
|
||||
width: ${p => p.theme.design.timingTower.rowHeightPx - 2}px;
|
||||
|
||||
left: ${p => -p.theme.design.timingTower.rowHeightPx + 2}px;
|
||||
overflow: clip;
|
||||
`;
|
||||
|
||||
export const FastestLapGem = styled.div<TransitionProps>`
|
||||
position: absolute;
|
||||
left: ${({ open }) => open ? 0
|
||||
: p => p.theme.design.timingTower.rowHeightPx}px;
|
||||
top: 0;
|
||||
|
||||
height: ${p => p.theme.design.timingTower.rowHeightPx}px;
|
||||
width: ${p => p.theme.design.timingTower.rowHeightPx - 2}px;
|
||||
|
||||
background-color: ${p => p.theme.colors.laps.purple};
|
||||
background-image: url(${fastestLapIcon});
|
||||
background-repeat: no-repeat;
|
||||
background-size: 89%;
|
||||
background-position: center 40%;
|
||||
|
||||
${({ transitionProps }) => commonTransition(transitionProps)}
|
||||
`;
|
||||
FastestLapGem.displayName = "FastestLapGem";
|
||||
+10
-1
@@ -8,7 +8,7 @@ import { broadcastDirectorSelector } from "../../../../features/broadcast/direct
|
||||
import { broadcastGraphicsSelector } from "../../../../features/broadcast/graphics/broadcastGraphicsSelector";
|
||||
import { setTimingTowerDisplayMode, setTimingTowerSplitsMode } from "../../../../features/broadcast/graphics/broadcastGraphicsSlice";
|
||||
import { eventSelector } from "../../../../features/event/eventSelector";
|
||||
import { increaseDistance, refreshRunningOrder, setCarStatus } from "../../../../features/event/eventSlice";
|
||||
import { awardFastestLap, increaseDistance, refreshRunningOrder, setCarStatus } from "../../../../features/event/eventSlice";
|
||||
import { BGTimingTowerDisplayMode, BGTimingTowerSplitsMode, CarStatus } from "../../../../types/state";
|
||||
import { GridSelection } from "../GridSelection";
|
||||
|
||||
@@ -90,6 +90,15 @@ export function TimingTowerPrototypeControls() {
|
||||
>
|
||||
Un-retire
|
||||
</ClickSpan>
|
||||
<ClickSpan
|
||||
onClick={() => {
|
||||
if (selectedCars.length > 0) {
|
||||
dispatch(awardFastestLap(selectedCars[0]));
|
||||
}
|
||||
}}
|
||||
>
|
||||
Award FL
|
||||
</ClickSpan>
|
||||
</InlineCluster>
|
||||
<hr />
|
||||
<InlineCluster gutter="md">
|
||||
|
||||
@@ -222,6 +222,10 @@ interface SetCarStatusAction {
|
||||
status: CarStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Note: Add `state.lastUpdate = Date.now();` to the end of every reducer to
|
||||
* keep components up to date that watch for changes with useEffect() functions.
|
||||
*/
|
||||
export const eventSlice = createSlice({
|
||||
name: "event",
|
||||
initialState,
|
||||
|
||||
+3
-1
@@ -20,13 +20,14 @@ export const theme = {
|
||||
disabledRed: "#e08a91",
|
||||
posLostRed: "#e40030",
|
||||
posGainedGreen: "#10ff35",
|
||||
posFastestLap: "#ae43ca",
|
||||
grey: "#aaa",
|
||||
lightGrey: "#ddd",
|
||||
faintGrey: "#eee",
|
||||
darkGrey: "#303030",
|
||||
dimGrey: "#999",
|
||||
videoFrameBG: "#333",
|
||||
positionFlagBG: "#f4f3ee",
|
||||
posWhite: "#f4f3ee",
|
||||
textWhite: "#f1f1f1", // I found it to be #f2f2f2 but whatever
|
||||
teams: { // 2021 Season
|
||||
alfaRomeo: "#900000",
|
||||
@@ -89,6 +90,7 @@ export const theme = {
|
||||
rowTravelDurationMs: 750,
|
||||
fullWidthDurationMs: 750,
|
||||
fullWidthCloseDelayMs: 333,
|
||||
fastestLapToastDurationMs: 500,
|
||||
},
|
||||
button: {
|
||||
borderRadius: "0.25rem",
|
||||
|
||||
Reference in new issue
Block a user