mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-30 19:39:10 +00:00
fix: timer type clock is not negative in public displays (#747)
This commit is contained in:
@@ -126,10 +126,11 @@ export default function MinimalTimer(props: MinimalTimerProps) {
|
|||||||
const hideEndMessage = searchParams.get('hideendmessage');
|
const hideEndMessage = searchParams.get('hideendmessage');
|
||||||
userOptions.hideEndMessage = isStringBoolean(hideEndMessage);
|
userOptions.hideEndMessage = isStringBoolean(hideEndMessage);
|
||||||
|
|
||||||
|
const timerIsTimeOfDay = time.timerType === TimerType.Clock;
|
||||||
|
|
||||||
const showOverlay = pres.text !== '' && pres.visible;
|
const showOverlay = pres.text !== '' && pres.visible;
|
||||||
const isPlaying = time.playback !== Playback.Pause;
|
const isPlaying = time.playback !== Playback.Pause;
|
||||||
const isNegative =
|
const isNegative = (time.current ?? 0) < 0 && !timerIsTimeOfDay && time.timerType !== TimerType.CountUp;
|
||||||
(time.current ?? 0) < 0 && time.timerType !== TimerType.Clock && time.timerType !== TimerType.CountUp;
|
|
||||||
const showEndMessage = (time.current ?? 0) < 0 && viewSettings.endMessage && !hideEndMessage;
|
const showEndMessage = (time.current ?? 0) < 0 && viewSettings.endMessage && !hideEndMessage;
|
||||||
const finished = time.playback === Playback.Play && (time.current ?? 0) < 0 && time.startedAt;
|
const finished = time.playback === Playback.Play && (time.current ?? 0) < 0 && time.startedAt;
|
||||||
const showFinished = finished && !userOptions?.hideOvertime && (time.timerType !== TimerType.Clock || showEndMessage);
|
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 showBlinking = pres.timerBlink;
|
||||||
const showBlackout = pres.timerBlackout;
|
const showBlackout = pres.timerBlackout;
|
||||||
|
|
||||||
const timerColor = userOptions.textColour
|
let timerColor = viewSettings.normalColor;
|
||||||
? userOptions.textColour
|
if (!timerIsTimeOfDay && showProgress && showDanger) timerColor = viewSettings.dangerColor;
|
||||||
: showProgress && showDanger
|
if (!timerIsTimeOfDay && showProgress && showWarning) timerColor = viewSettings.warningColor;
|
||||||
? viewSettings.dangerColor
|
|
||||||
: showProgress && showWarning
|
|
||||||
? viewSettings.warningColor
|
|
||||||
: viewSettings.normalColor;
|
|
||||||
|
|
||||||
const stageTimer = getTimerByType(time);
|
const stageTimer = getTimerByType(time);
|
||||||
let display = formatTimerDisplay(stageTimer);
|
let display = formatTimerDisplay(stageTimer);
|
||||||
|
|||||||
@@ -90,8 +90,9 @@ export default function Timer(props: TimerProps) {
|
|||||||
const showOverlay = pres.text !== '' && pres.visible;
|
const showOverlay = pres.text !== '' && pres.visible;
|
||||||
const isPlaying = time.playback !== Playback.Pause;
|
const isPlaying = time.playback !== Playback.Pause;
|
||||||
|
|
||||||
const isNegative =
|
const timerIsTimeOfDay = time.timerType === TimerType.Clock;
|
||||||
(time.current ?? 0) < 0 && time.timerType !== TimerType.Clock && time.timerType !== TimerType.CountUp;
|
|
||||||
|
const isNegative = (time.current ?? 0) < 0 && !timerIsTimeOfDay && time.timerType !== TimerType.CountUp;
|
||||||
const finished = time.playback === Playback.Play && (time.current ?? 0) < 0 && time.startedAt;
|
const finished = time.playback === Playback.Play && (time.current ?? 0) < 0 && time.startedAt;
|
||||||
const totalTime = (time.duration ?? 0) + (time.addedTime ?? 0);
|
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 showClock = time.timerType !== TimerType.Clock;
|
||||||
const showExternal = external.visible && external.text;
|
const showExternal = external.visible && external.text;
|
||||||
|
|
||||||
const timerColor =
|
let timerColor = viewSettings.normalColor;
|
||||||
showProgress && showDanger
|
if (!timerIsTimeOfDay && showProgress && showDanger) timerColor = viewSettings.dangerColor;
|
||||||
? viewSettings.dangerColor
|
if (!timerIsTimeOfDay && showProgress && showWarning) timerColor = viewSettings.warningColor;
|
||||||
: showProgress && showWarning
|
|
||||||
? viewSettings.warningColor
|
|
||||||
: viewSettings.normalColor;
|
|
||||||
|
|
||||||
const stageTimer = getTimerByType(time);
|
const stageTimer = getTimerByType(time);
|
||||||
let display = formatTimerDisplay(stageTimer);
|
let display = formatTimerDisplay(stageTimer);
|
||||||
@@ -173,7 +171,7 @@ export default function Timer(props: TimerProps) {
|
|||||||
{!userOptions.hideProgress && (
|
{!userOptions.hideProgress && (
|
||||||
<MultiPartProgressBar
|
<MultiPartProgressBar
|
||||||
className={isPlaying ? 'progress-container' : 'progress-container progress-container--paused'}
|
className={isPlaying ? 'progress-container' : 'progress-container progress-container--paused'}
|
||||||
now={time.current}
|
now={timerIsTimeOfDay ? null : time.current}
|
||||||
complete={totalTime}
|
complete={totalTime}
|
||||||
normalColor={viewSettings.normalColor}
|
normalColor={viewSettings.normalColor}
|
||||||
warning={viewSettings.warningThreshold}
|
warning={viewSettings.warningThreshold}
|
||||||
|
|||||||
Reference in New Issue
Block a user