refactor: allow overriding progress bar phases

This commit is contained in:
Carlos Valente
2025-01-24 10:29:52 +01:00
committed by Carlos Valente
parent 46790441e0
commit 28452d1e38
5 changed files with 71 additions and 52 deletions
@@ -53,3 +53,6 @@ $progress-bar-br: 3px;
.multiprogress-bar__bg-danger { .multiprogress-bar__bg-danger {
flex-shrink: 0; flex-shrink: 0;
} }
.multiprogress-bar__bg-danger--overtime {
background: var(--timer-overtime-color-override, $timer-finished-color);
}
@@ -14,6 +14,7 @@ interface MultiPartProgressBar {
danger?: MaybeNumber; danger?: MaybeNumber;
dangerColor: string; dangerColor: string;
hidden?: boolean; hidden?: boolean;
hideOvertime?: boolean;
ignoreCssOverride?: boolean; ignoreCssOverride?: boolean;
className?: string; className?: string;
} }
@@ -28,6 +29,7 @@ export default function MultiPartProgressBar(props: MultiPartProgressBar) {
danger, danger,
dangerColor, dangerColor,
hidden, hidden,
hideOvertime,
ignoreCssOverride, ignoreCssOverride,
className = '', className = '',
} = props; } = props;
@@ -35,6 +37,8 @@ export default function MultiPartProgressBar(props: MultiPartProgressBar) {
const percentRemaining = 100 - getProgress(now, complete); const percentRemaining = 100 - getProgress(now, complete);
const dangerWidth = danger ? 100 - getProgress(danger, complete) : 0; const dangerWidth = danger ? 100 - getProgress(danger, complete) : 0;
const warningWidth = warning ? 100 - dangerWidth - getProgress(warning, complete) : 0; const warningWidth = warning ? 100 - dangerWidth - getProgress(warning, complete) : 0;
const isOvertime = now !== null && now < 0;
const showOvertime = isOvertime && !hideOvertime;
return ( return (
<div <div
@@ -54,8 +58,8 @@ export default function MultiPartProgressBar(props: MultiPartProgressBar) {
style={{ width: `${warningWidth}%`, backgroundColor: warningColor }} style={{ width: `${warningWidth}%`, backgroundColor: warningColor }}
/> />
<div <div
className='multiprogress-bar__bg-danger' className={cx(['multiprogress-bar__bg-danger', showOvertime && 'multiprogress-bar__bg-danger--overtime'])}
style={{ width: `${dangerWidth}%`, backgroundColor: dangerColor }} style={{ width: `${dangerWidth}%`, backgroundColor: showOvertime ? undefined : dangerColor }}
/> />
</div> </div>
<div className='multiprogress-bar__indicator'> <div className='multiprogress-bar__indicator'>
+11 -3
View File
@@ -18,7 +18,7 @@
flex-direction: column; flex-direction: column;
&--finished { &--finished {
outline: clamp(4px, 1vw, 16px) solid $timer-finished-color; outline: clamp(4px, 1vw, 16px) solid var(--timer-overtime-color-override, $timer-finished-color);
outline-offset: calc(clamp(4px, 1vw, 16px) * -1); outline-offset: calc(clamp(4px, 1vw, 16px) * -1);
transition: $viewer-transition-time; transition: $viewer-transition-time;
} }
@@ -95,7 +95,7 @@
font-size: 11.5vw; font-size: 11.5vw;
line-height: 0.9em; line-height: 0.9em;
font-weight: 600; font-weight: 600;
color: $timer-finished-color; color: var(--timer-overtime-color-override, $timer-finished-color);
padding: 0; padding: 0;
} }
@@ -116,8 +116,16 @@
transition: $viewer-transition-time; transition: $viewer-transition-time;
} }
// use a class instead of a phase, to allow suppressing overtime style
&--finished { &--finished {
color: $timer-finished-color; color: var(--timer-overtime-color-override, $timer-finished-color);
}
&[data-phase="warning"] {
color: var(--timer-warning-color-override, var(--phase-color));
}
&[data-phase="danger"] {
color: var(--timer-danger-color-override, var(--phase-color));
} }
} }
} }
+2
View File
@@ -153,6 +153,7 @@ export default function Timer(props: TimerProps) {
fontSize: `${timerFontSize}vw`, fontSize: `${timerFontSize}vw`,
'--phase-color': timerColour, '--phase-color': timerColour,
}} }}
data-phase={time.phase}
> >
{display} {display}
</div> </div>
@@ -175,6 +176,7 @@ export default function Timer(props: TimerProps) {
warningColor={viewSettings.warningColor} warningColor={viewSettings.warningColor}
danger={eventNow?.timeDanger} danger={eventNow?.timeDanger}
dangerColor={viewSettings.dangerColor} dangerColor={viewSettings.dangerColor}
hideOvertime={!showFinished}
/> />
)} )}
+49 -47
View File
@@ -5,60 +5,62 @@
*/ */
:root { :root {
/** Background colour for the views */ /** Background colour for the views */
--background-color-override: #ececec; --background-color-override: #ececec;
/** Main text colour for the views */
--color-override: #101010;
/** Text colour for the views */
--secondary-color-override: #404040;
/** Accent text colour, used on active elements */ /** Main text colour for the views */
--accent-color-override: #fa5656; --color-override: #101010;
/** Label text colour, used on active elements */ /** Text colour for the views */
--label-color-override: #6c6c6c; --secondary-color-override: #404040;
/** Timer text colour */ /** Accent text colour, used on active elements */
--timer-color-override: #202020; --accent-color-override: #fa5656;
/** Background for card elements on background */ /** Label text colour, used on active elements */
--card-background-color-override: #fff; --label-color-override: #6c6c6c;
/** Background highlight for blink behaviour, used only in /backstage */ /** Timer text colour */
--card-background-color-blink-override: #339e4e; --timer-color-override: #202020;
--timer-warning-color-override: #ffbc56;
/** Font used for all text in views */ --timer-danger-color-override: #e69000;
--font-family-override: "Open Sans"; --timer-overtime-color-override: #fa5656;
/** Font used for clock in /minimal and /clock views */ /** Background for card elements on background */
--font-family-bold-override: "Arial Black"; --card-background-color-override: #fff;
/** Colour used for progress bar background */ /** Font used for all text in views */
--timer-progress-bg-override: #fff; --font-family-override: 'Open Sans';
/** Colour used for progress bar progress */ /** Font used for clock in /minimal and /clock views */
--timer-progress-override: #202020; --font-family-bold-override: 'Arial Black';
/** Colour used for external message and aux timer in /timer */ /** Colour used for external message and aux timer in /timer */
--external-color-override: #161616; --external-color-override: #161616;
/** View specific features: /studio */ /** View specific features: /backstage */
--studio-active: #101010; /** ---- Background highlight for blink behaviour */
--studio-idle: #cfcfcf; --card-background-color-blink-override: #339e4e;
--studio-active-label: #101010; /** ---- Colour used for progress bar background */
--studio-idle-label: #595959; --timer-progress-bg-override: #fff;
--studio-overtime: #101010; /** ---- Colour used for progress bar progress */
--timer-progress-override: #202020;
/** View specific features: /lower */
--lowerThird-font-family-override: 'Courier New'; /** View specific features: /studio */
--lowerThird-top-font-weight-override: bold; --studio-active: #101010;
--lowerThird-bottom-font-weight-override: bold; --studio-idle: #cfcfcf;
--lowerThird-top-font-style-override: normal; --studio-active-label: #101010;
--lowerThird-bottom-font-style-override: italic; --studio-idle-label: #595959;
--lowerThird-line-height-override: 1vh; --studio-overtime: #101010;
--lowerThird-text-align-override: end;
/** View specific features: /lower */
--lowerThird-font-family-override: 'Courier New';
--lowerThird-top-font-weight-override: bold;
--lowerThird-bottom-font-weight-override: bold;
--lowerThird-top-font-style-override: normal;
--lowerThird-bottom-font-style-override: italic;
--lowerThird-line-height-override: 1vh;
--lowerThird-text-align-override: end;
} }
/** /**
@@ -66,5 +68,5 @@
* In the below example, we change the colour of the overlay message in the stage-timer view. * In the below example, we change the colour of the overlay message in the stage-timer view.
*/ */
.stage-timer > .message-overlay--active > div { .stage-timer > .message-overlay--active > div {
color: red; color: red;
} }