mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-12 02:43:50 +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;
|
||||
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',
|
||||
|
||||
Reference in New Issue
Block a user