mirror of
https://github.com/cpvalente/ontime.git
synced 2026-09-07 23:39:09 +00:00
refactor: show leading zeroes in minimal
This commit is contained in:
committed by
Carlos Valente
parent
9ba94288a1
commit
9440ad17d2
@@ -15,4 +15,5 @@ export type OverridableOptions = {
|
|||||||
language?: string;
|
language?: string;
|
||||||
showProgressBar?: boolean;
|
showProgressBar?: boolean;
|
||||||
hideTimerSeconds?: boolean;
|
hideTimerSeconds?: boolean;
|
||||||
|
removeLeadingZeros?: boolean;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -115,6 +115,9 @@ 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 showLeadingZeros = searchParams.get('showLeadingZeros');
|
||||||
|
userOptions.removeLeadingZeros = !isStringBoolean(showLeadingZeros);
|
||||||
|
|
||||||
const timerIsTimeOfDay = time.timerType === TimerType.Clock;
|
const timerIsTimeOfDay = time.timerType === TimerType.Clock;
|
||||||
|
|
||||||
const isPlaying = time.playback !== Playback.Pause;
|
const isPlaying = time.playback !== Playback.Pause;
|
||||||
@@ -135,7 +138,7 @@ export default function MinimalTimer(props: MinimalTimerProps) {
|
|||||||
const stageTimer = getTimerByType(viewSettings.freezeEnd, time);
|
const stageTimer = getTimerByType(viewSettings.freezeEnd, time);
|
||||||
const display = getFormattedTimer(stageTimer, time.timerType, getLocalizedString('common.minutes'), {
|
const display = getFormattedTimer(stageTimer, time.timerType, getLocalizedString('common.minutes'), {
|
||||||
removeSeconds: userOptions.hideTimerSeconds,
|
removeSeconds: userOptions.hideTimerSeconds,
|
||||||
removeLeadingZero: true,
|
removeLeadingZero: userOptions.removeLeadingZeros,
|
||||||
});
|
});
|
||||||
|
|
||||||
const stageTimerCharacters = display.replace('/:/g', '').length;
|
const stageTimerCharacters = display.replace('/:/g', '').length;
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import { hideTimerSeconds } from '../../../common/components/view-params-editor/constants';
|
import { hideTimerSeconds, showLeadingZeros } from '../../../common/components/view-params-editor/constants';
|
||||||
import { ViewOption } from '../../../common/components/view-params-editor/types';
|
import { ViewOption } from '../../../common/components/view-params-editor/types';
|
||||||
|
|
||||||
export const MINIMAL_TIMER_OPTIONS: ViewOption[] = [
|
export const MINIMAL_TIMER_OPTIONS: ViewOption[] = [
|
||||||
{ section: 'Timer Options' },
|
{ section: 'Timer Options' },
|
||||||
hideTimerSeconds,
|
hideTimerSeconds,
|
||||||
|
showLeadingZeros,
|
||||||
{ section: 'Element visibility' },
|
{ section: 'Element visibility' },
|
||||||
{
|
{
|
||||||
id: 'hideovertime',
|
id: 'hideovertime',
|
||||||
|
|||||||
Reference in New Issue
Block a user