fix: phase style overrides in timer

This commit is contained in:
Carlos Valente
2025-09-09 07:39:38 +02:00
committed by Carlos Valente
parent 490e429f44
commit bfbf8574e3
4 changed files with 9 additions and 28 deletions
@@ -1,19 +0,0 @@
export type OverridableOptions = {
keyColour?: string;
textColour?: string;
textBackground?: string;
font?: string;
size?: number;
justifyContent?: 'start' | 'center' | 'end';
alignItems?: 'start' | 'center' | 'end';
left?: string;
top?: string;
hideNav?: boolean;
hideOvertime?: boolean;
hideMessagesOverlay?: boolean;
hideEndMessage?: boolean;
language?: string;
showProgressBar?: boolean;
hideTimerSeconds?: boolean;
removeLeadingZeros?: boolean;
};
+3 -3
View File
@@ -68,7 +68,7 @@ function Timer({ customFields, projectData, isMirrored, settings, viewSettings }
hidePhase, hidePhase,
font, font,
keyColour, keyColour,
textColour, timerColour,
} = useTimerOptions(); } = useTimerOptions();
const { getLocalizedString } = useTranslation(); const { getLocalizedString } = useTranslation();
@@ -131,11 +131,11 @@ function Timer({ customFields, projectData, isMirrored, settings, viewSettings }
); );
// gather presentation styles // gather presentation styles
const timerColour = getTimerColour(viewSettings, textColour, showWarning, showDanger); const resolvedTimerColour = getTimerColour(viewSettings, timerColour, showWarning, showDanger);
const { timerFontSize, externalFontSize } = getEstimatedFontSize(display, secondaryContent); const { timerFontSize, externalFontSize } = getEstimatedFontSize(display, secondaryContent);
const userStyles = { const userStyles = {
...(keyColour && { '--timer-bg': keyColour }), ...(keyColour && { '--timer-bg': keyColour }),
...(textColour && { '--timer-colour': timerColour }), ...(resolvedTimerColour && { '--timer-colour': resolvedTimerColour }),
...(font && { '--timer-font': font }), ...(font && { '--timer-font': font }),
}; };
+5 -5
View File
@@ -163,9 +163,9 @@ export const getTimerOptions = (timeFormat: string, customFields: CustomFields):
defaultValue: '101010', defaultValue: '101010',
}, },
{ {
id: 'textColour', id: 'timerColour',
title: 'Text Colour', title: 'Timer Colour',
description: 'Text colour. Default: #f6f6f6', description: 'Timer colour. Default: #f6f6f6',
type: 'colour', type: 'colour',
defaultValue: 'f6f6f6', defaultValue: 'f6f6f6',
}, },
@@ -191,7 +191,7 @@ type TimerOptions = {
hidePhase: boolean; hidePhase: boolean;
font?: string; font?: string;
keyColour?: string; keyColour?: string;
textColour?: string; timerColour?: string;
}; };
/** /**
@@ -226,7 +226,7 @@ function getOptionsFromParams(searchParams: URLSearchParams, defaultValues?: URL
font: getValue('font') ?? undefined, font: getValue('font') ?? undefined,
keyColour: makeColourString(getValue('keyColour')), keyColour: makeColourString(getValue('keyColour')),
textColour: makeColourString(getValue('textColour')), timerColour: makeColourString(getValue('timerColour')),
}; };
} }
+1 -1
View File
@@ -337,7 +337,7 @@ export const demoDb: DatabaseModel = {
alias: 'minimal', alias: 'minimal',
target: OntimeView.Timer, target: OntimeView.Timer,
search: search:
'hideclock=true&hidecards=true&hideprogress=true&hidemessage=true&hidesecondary=true&hidelogo=true&font=arial+black&keycolour=00ff00&textcolour=ffffff', 'hideclock=true&hidecards=true&hideprogress=true&hidemessage=true&hidesecondary=true&hidelogo=true&font=arial+black&keycolour=00ff00&timerColour=ffffff',
}, },
], ],
customFields: { customFields: {