From 965a7092d908ea61d37bdf54882451614f75c9d4 Mon Sep 17 00:00:00 2001 From: Carlos Valente <34649812+cpvalente@users.noreply.github.com> Date: Tue, 30 Jan 2024 12:35:36 +0100 Subject: [PATCH] fix: timer type clock is not negative in public displays (#747) --- .../viewers/minimal-timer/MinimalTimer.tsx | 15 ++++++--------- apps/client/src/features/viewers/timer/Timer.tsx | 16 +++++++--------- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/apps/client/src/features/viewers/minimal-timer/MinimalTimer.tsx b/apps/client/src/features/viewers/minimal-timer/MinimalTimer.tsx index c41c8d0f3..eaae731d5 100644 --- a/apps/client/src/features/viewers/minimal-timer/MinimalTimer.tsx +++ b/apps/client/src/features/viewers/minimal-timer/MinimalTimer.tsx @@ -126,10 +126,11 @@ export default function MinimalTimer(props: MinimalTimerProps) { const hideEndMessage = searchParams.get('hideendmessage'); userOptions.hideEndMessage = isStringBoolean(hideEndMessage); + const timerIsTimeOfDay = time.timerType === TimerType.Clock; + const showOverlay = pres.text !== '' && pres.visible; const isPlaying = time.playback !== Playback.Pause; - const isNegative = - (time.current ?? 0) < 0 && time.timerType !== TimerType.Clock && time.timerType !== TimerType.CountUp; + const isNegative = (time.current ?? 0) < 0 && !timerIsTimeOfDay && time.timerType !== TimerType.CountUp; const showEndMessage = (time.current ?? 0) < 0 && viewSettings.endMessage && !hideEndMessage; const finished = time.playback === Playback.Play && (time.current ?? 0) < 0 && time.startedAt; const showFinished = finished && !userOptions?.hideOvertime && (time.timerType !== TimerType.Clock || showEndMessage); @@ -140,13 +141,9 @@ export default function MinimalTimer(props: MinimalTimerProps) { const showBlinking = pres.timerBlink; const showBlackout = pres.timerBlackout; - const timerColor = userOptions.textColour - ? userOptions.textColour - : showProgress && showDanger - ? viewSettings.dangerColor - : showProgress && showWarning - ? viewSettings.warningColor - : viewSettings.normalColor; + let timerColor = viewSettings.normalColor; + if (!timerIsTimeOfDay && showProgress && showDanger) timerColor = viewSettings.dangerColor; + if (!timerIsTimeOfDay && showProgress && showWarning) timerColor = viewSettings.warningColor; const stageTimer = getTimerByType(time); let display = formatTimerDisplay(stageTimer); diff --git a/apps/client/src/features/viewers/timer/Timer.tsx b/apps/client/src/features/viewers/timer/Timer.tsx index f05ddcffb..91b9767ef 100644 --- a/apps/client/src/features/viewers/timer/Timer.tsx +++ b/apps/client/src/features/viewers/timer/Timer.tsx @@ -90,8 +90,9 @@ export default function Timer(props: TimerProps) { const showOverlay = pres.text !== '' && pres.visible; const isPlaying = time.playback !== Playback.Pause; - const isNegative = - (time.current ?? 0) < 0 && time.timerType !== TimerType.Clock && time.timerType !== TimerType.CountUp; + const timerIsTimeOfDay = time.timerType === TimerType.Clock; + + const isNegative = (time.current ?? 0) < 0 && !timerIsTimeOfDay && time.timerType !== TimerType.CountUp; const finished = time.playback === Playback.Play && (time.current ?? 0) < 0 && time.startedAt; const totalTime = (time.duration ?? 0) + (time.addedTime ?? 0); @@ -105,12 +106,9 @@ export default function Timer(props: TimerProps) { const showClock = time.timerType !== TimerType.Clock; const showExternal = external.visible && external.text; - const timerColor = - showProgress && showDanger - ? viewSettings.dangerColor - : showProgress && showWarning - ? viewSettings.warningColor - : viewSettings.normalColor; + let timerColor = viewSettings.normalColor; + if (!timerIsTimeOfDay && showProgress && showDanger) timerColor = viewSettings.dangerColor; + if (!timerIsTimeOfDay && showProgress && showWarning) timerColor = viewSettings.warningColor; const stageTimer = getTimerByType(time); let display = formatTimerDisplay(stageTimer); @@ -173,7 +171,7 @@ export default function Timer(props: TimerProps) { {!userOptions.hideProgress && (