From 4e9c57befb136fc3b7c392174fee936627d05e39 Mon Sep 17 00:00:00 2001 From: Matthew Stratford Date: Tue, 27 Oct 2020 19:22:21 +0000 Subject: [PATCH] Fix triggering blinky play. Fixes #120 --- src/showplanner/Player.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/showplanner/Player.tsx b/src/showplanner/Player.tsx index bc463e2..d794ac3 100644 --- a/src/showplanner/Player.tsx +++ b/src/showplanner/Player.tsx @@ -192,9 +192,17 @@ function TimingButtons({ id }: { id: number }) { } export function Player({ id }: { id: number }) { + // Define time remaining (secs) when the play icon should flash. + const SECS_REMAINING_WARNING = 20; + + // We want to force update the selector when we pass the SECS_REMAINING_WARNING barrier. const playerState = useSelector( (state: RootState) => state.mixer.players[id], (a, b) => + !( + a.timeRemaining <= SECS_REMAINING_WARNING && + b.timeRemaining > SECS_REMAINING_WARNING + ) && shallowEqual( omit(a, "timeCurrent", "timeRemaining"), omit(b, "timeCurrent", "timeRemaining") @@ -319,7 +327,7 @@ export function Player({ id }: { id: number }) { onClick={() => dispatch(MixerState.play(id))} className={ playerState.state === "playing" - ? playerState.timeRemaining <= 15 + ? playerState.timeRemaining <= SECS_REMAINING_WARNING ? "sp-state-playing sp-ending-soon" : "sp-state-playing" : ""