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,
font,
keyColour,
textColour,
timerColour,
} = useTimerOptions();
const { getLocalizedString } = useTranslation();
@@ -131,11 +131,11 @@ function Timer({ customFields, projectData, isMirrored, settings, viewSettings }
);
// gather presentation styles
const timerColour = getTimerColour(viewSettings, textColour, showWarning, showDanger);
const resolvedTimerColour = getTimerColour(viewSettings, timerColour, showWarning, showDanger);
const { timerFontSize, externalFontSize } = getEstimatedFontSize(display, secondaryContent);
const userStyles = {
...(keyColour && { '--timer-bg': keyColour }),
...(textColour && { '--timer-colour': timerColour }),
...(resolvedTimerColour && { '--timer-colour': resolvedTimerColour }),
...(font && { '--timer-font': font }),
};
+5 -5
View File
@@ -163,9 +163,9 @@ export const getTimerOptions = (timeFormat: string, customFields: CustomFields):
defaultValue: '101010',
},
{
id: 'textColour',
title: 'Text Colour',
description: 'Text colour. Default: #f6f6f6',
id: 'timerColour',
title: 'Timer Colour',
description: 'Timer colour. Default: #f6f6f6',
type: 'colour',
defaultValue: 'f6f6f6',
},
@@ -191,7 +191,7 @@ type TimerOptions = {
hidePhase: boolean;
font?: string;
keyColour?: string;
textColour?: string;
timerColour?: string;
};
/**
@@ -226,7 +226,7 @@ function getOptionsFromParams(searchParams: URLSearchParams, defaultValues?: URL
font: getValue('font') ?? undefined,
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',
target: OntimeView.Timer,
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: {