From 9440ad17d210872158357bb1a80185c9ebbe40e4 Mon Sep 17 00:00:00 2001 From: Carlos Valente Date: Thu, 7 Nov 2024 21:23:37 +0100 Subject: [PATCH] refactor: show leading zeroes in minimal --- apps/client/src/common/models/View.types.ts | 1 + .../src/features/viewers/minimal-timer/MinimalTimer.tsx | 5 ++++- .../features/viewers/minimal-timer/minimalTimer.options.ts | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/client/src/common/models/View.types.ts b/apps/client/src/common/models/View.types.ts index 91592ce6a..2d8979a66 100644 --- a/apps/client/src/common/models/View.types.ts +++ b/apps/client/src/common/models/View.types.ts @@ -15,4 +15,5 @@ export type OverridableOptions = { language?: string; showProgressBar?: boolean; hideTimerSeconds?: boolean; + removeLeadingZeros?: boolean; }; diff --git a/apps/client/src/features/viewers/minimal-timer/MinimalTimer.tsx b/apps/client/src/features/viewers/minimal-timer/MinimalTimer.tsx index c0c5cc63e..ee04c66e0 100644 --- a/apps/client/src/features/viewers/minimal-timer/MinimalTimer.tsx +++ b/apps/client/src/features/viewers/minimal-timer/MinimalTimer.tsx @@ -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; diff --git a/apps/client/src/features/viewers/minimal-timer/minimalTimer.options.ts b/apps/client/src/features/viewers/minimal-timer/minimalTimer.options.ts index 6cf307a28..873625ee1 100644 --- a/apps/client/src/features/viewers/minimal-timer/minimalTimer.options.ts +++ b/apps/client/src/features/viewers/minimal-timer/minimalTimer.options.ts @@ -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',