refactor(progress bar): reset when event changes

This commit is contained in:
Carlos Valente
2026-08-01 12:50:37 +02:00
committed by Carlos Valente
parent 24be49ef66
commit fb559ed9da
11 changed files with 47 additions and 23 deletions
@@ -114,7 +114,14 @@ function Backstage({ events, customFields, projectData, isMirrored, settings }:
<BackstageClock timeformat={timeformat} />
</div>
{showProgress && <ProgressBar className='progress-container' current={time.current} duration={time.duration} />}
{showProgress && (
<ProgressBar
className='progress-container'
current={time.current}
duration={time.duration}
eventId={selectedEventId}
/>
)}
{!hasEvents && <Empty text={getLocalizedString('common.no_data')} className='empty-container' />}
@@ -6,12 +6,13 @@ import styles from './CuesheetProgress.module.scss';
export default function CuesheetProgress() {
const { data } = useViewSettings();
const { current, duration, timeWarning, timeDanger } = useProgressData();
const { current, duration, eventId, timeWarning, timeDanger } = useProgressData();
return (
<MultiPartProgressBar
now={current}
complete={duration}
eventId={eventId}
normalColor={data.normalColor}
warning={timeWarning}
warningColor={data.warningColor}
@@ -96,6 +96,7 @@ export function PipTimer({ viewSettings }: PipTimerProps) {
className={cx(['progress-container', !isPlaying && 'progress-container--paused'])}
now={time.current}
complete={totalTime}
eventId={eventNow?.id}
normalColor={viewSettings.normalColor}
warning={eventNow?.timeWarning}
warningColor={viewSettings.warningColor}
@@ -2,7 +2,7 @@ import { Day } from 'ontime-types';
import { CSSProperties, RefObject } from 'react';
import { useAnimatedProgress } from '../../common/hooks/useAnimatedProgress';
import { useExpectedStartData, useTimer } from '../../common/hooks/useSocket';
import { useExpectedStartData, useSelectedEventId, useTimer } from '../../common/hooks/useSocket';
import { alpha, cx } from '../../common/utils/styleUtils';
import { formatDuration, formatTime, getExpectedTimesFromExtendedEvent } from '../../common/utils/time';
import { useTranslation } from '../../translation/TranslationProvider';
@@ -169,7 +169,8 @@ function TimelineEntryStatus({
/** Generates a block level progress bar */
function ActiveBlock() {
const { current, duration } = useTimer();
const progress = useAnimatedProgress(current, duration);
const eventId = useSelectedEventId();
const progress = useAnimatedProgress(current, duration, eventId);
return (
<div data-status='live' className={style.timelineBlock} style={{ '--progress': `${progress}%` } as CSSProperties} />
);
+1
View File
@@ -195,6 +195,7 @@ function Timer({ customFields, projectData, isMirrored, settings, viewSettings,
className={cx(['progress-container', !isPlaying && 'progress-container--paused'])}
now={time.current}
complete={totalTime}
eventId={eventNow?.id}
normalColor={viewSettings.normalColor}
warning={eventNow?.timeWarning}
warningColor={viewSettings.warningColor}