mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-21 23:19:09 +00:00
Merge remote-tracking branch 'origin/master' into v3
This commit is contained in:
@@ -132,6 +132,8 @@ export default function MinimalTimer(props: MinimalTimerProps) {
|
|||||||
const hideTimerSeconds = searchParams.get('hideTimerSeconds');
|
const hideTimerSeconds = searchParams.get('hideTimerSeconds');
|
||||||
userOptions.hideTimerSeconds = isStringBoolean(hideTimerSeconds);
|
userOptions.hideTimerSeconds = isStringBoolean(hideTimerSeconds);
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
@@ -145,13 +147,9 @@ export default function MinimalTimer(props: MinimalTimerProps) {
|
|||||||
const showBlinking = pres.blink;
|
const showBlinking = pres.blink;
|
||||||
const showBlackout = pres.blackout;
|
const showBlackout = pres.blackout;
|
||||||
|
|
||||||
const timerColor = userOptions.textColour
|
let timerColor = viewSettings.normalColor;
|
||||||
? userOptions.textColour
|
if (!timerIsTimeOfDay && showProgress && showWarning) timerColor = viewSettings.warningColor;
|
||||||
: showProgress && showDanger
|
if (!timerIsTimeOfDay && showProgress && showDanger) timerColor = viewSettings.dangerColor;
|
||||||
? viewSettings.dangerColor
|
|
||||||
: showProgress && showWarning
|
|
||||||
? viewSettings.warningColor
|
|
||||||
: viewSettings.normalColor;
|
|
||||||
|
|
||||||
const stageTimer = getTimerByType(time);
|
const stageTimer = getTimerByType(time);
|
||||||
let display = millisToString(stageTimer, { fallback: timerPlaceholder });
|
let display = millisToString(stageTimer, { fallback: timerPlaceholder });
|
||||||
@@ -161,7 +159,7 @@ export default function MinimalTimer(props: MinimalTimerProps) {
|
|||||||
}
|
}
|
||||||
display = removeLeadingZero(display);
|
display = removeLeadingZero(display);
|
||||||
// last unit rounds up in negative timers
|
// last unit rounds up in negative timers
|
||||||
const isNegative = stageTimer ?? 0 < 0;
|
const isNegative = (stageTimer ?? 0 < 0) && !timerIsTimeOfDay && time.timerType !== TimerType.CountUp;
|
||||||
if (isNegative && display === '0') {
|
if (isNegative && display === '0') {
|
||||||
display = '-1';
|
display = '-1';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import ViewParamsEditor from '../../../common/components/view-params-editor/View
|
|||||||
import { useRuntimeStylesheet } from '../../../common/hooks/useRuntimeStylesheet';
|
import { useRuntimeStylesheet } from '../../../common/hooks/useRuntimeStylesheet';
|
||||||
import { ViewExtendedTimer } from '../../../common/models/TimeManager.type';
|
import { ViewExtendedTimer } from '../../../common/models/TimeManager.type';
|
||||||
import { timerPlaceholder } from '../../../common/utils/styleUtils';
|
import { timerPlaceholder } from '../../../common/utils/styleUtils';
|
||||||
import { formatTime, getDefaultFormat } from '../../../common/utils/time';
|
import { formatTime } from '../../../common/utils/time';
|
||||||
import { isStringBoolean } from '../../../common/utils/viewUtils';
|
import { isStringBoolean } from '../../../common/utils/viewUtils';
|
||||||
import { useTranslation } from '../../../translation/TranslationProvider';
|
import { useTranslation } from '../../../translation/TranslationProvider';
|
||||||
import SuperscriptTime from '../common/superscript-time/SuperscriptTime';
|
import SuperscriptTime from '../common/superscript-time/SuperscriptTime';
|
||||||
@@ -95,6 +95,8 @@ 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 timerIsTimeOfDay = time.timerType === TimerType.Clock;
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
@@ -108,12 +110,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 && showWarning) timerColor = viewSettings.warningColor;
|
||||||
? viewSettings.dangerColor
|
if (!timerIsTimeOfDay && showProgress && showDanger) timerColor = viewSettings.dangerColor;
|
||||||
: showProgress && showWarning
|
|
||||||
? viewSettings.warningColor
|
|
||||||
: viewSettings.normalColor;
|
|
||||||
|
|
||||||
const stageTimer = getTimerByType(time);
|
const stageTimer = getTimerByType(time);
|
||||||
let display = millisToString(stageTimer, { fallback: timerPlaceholder });
|
let display = millisToString(stageTimer, { fallback: timerPlaceholder });
|
||||||
@@ -123,7 +122,7 @@ export default function Timer(props: TimerProps) {
|
|||||||
}
|
}
|
||||||
display = removeLeadingZero(display);
|
display = removeLeadingZero(display);
|
||||||
// last unit rounds up in negative timers
|
// last unit rounds up in negative timers
|
||||||
const isNegative = stageTimer ?? 0 < 0;
|
const isNegative = (stageTimer ?? 0 < 0) && !timerIsTimeOfDay && time.timerType !== TimerType.CountUp;
|
||||||
if (isNegative && display === '0') {
|
if (isNegative && display === '0') {
|
||||||
display = '-1';
|
display = '-1';
|
||||||
}
|
}
|
||||||
@@ -188,7 +187,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={eventNow?.timeWarning}
|
warning={eventNow?.timeWarning}
|
||||||
|
|||||||
Reference in New Issue
Block a user