refactor: show leading zeroes in minimal

This commit is contained in:
Carlos Valente
2024-11-07 21:23:37 +01:00
committed by Carlos Valente
parent 9ba94288a1
commit 9440ad17d2
3 changed files with 7 additions and 2 deletions
@@ -15,4 +15,5 @@ export type OverridableOptions = {
language?: string;
showProgressBar?: boolean;
hideTimerSeconds?: boolean;
removeLeadingZeros?: boolean;
};
@@ -115,6 +115,9 @@ export default function MinimalTimer(props: MinimalTimerProps) {
const hideTimerSeconds = searchParams.get('hideTimerSeconds');
userOptions.hideTimerSeconds = isStringBoolean(hideTimerSeconds);
const showLeadingZeros = searchParams.get('showLeadingZeros');
userOptions.removeLeadingZeros = !isStringBoolean(showLeadingZeros);
const timerIsTimeOfDay = time.timerType === TimerType.Clock;
const isPlaying = time.playback !== Playback.Pause;
@@ -135,7 +138,7 @@ export default function MinimalTimer(props: MinimalTimerProps) {
const stageTimer = getTimerByType(viewSettings.freezeEnd, time);
const display = getFormattedTimer(stageTimer, time.timerType, getLocalizedString('common.minutes'), {
removeSeconds: userOptions.hideTimerSeconds,
removeLeadingZero: true,
removeLeadingZero: userOptions.removeLeadingZeros,
});
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';
export const MINIMAL_TIMER_OPTIONS: ViewOption[] = [
{ section: 'Timer Options' },
hideTimerSeconds,
showLeadingZeros,
{ section: 'Element visibility' },
{
id: 'hideovertime',