From f5753a0f5a469f279509e24d41839cdfbd5c03d8 Mon Sep 17 00:00:00 2001 From: Carlos Valente Date: Wed, 12 Nov 2025 06:25:02 +0100 Subject: [PATCH] refactor(timeline): default to fixed size timeline --- apps/client/src/views/timeline/Timeline.tsx | 10 +++++----- apps/client/src/views/timeline/timeline.options.ts | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/apps/client/src/views/timeline/Timeline.tsx b/apps/client/src/views/timeline/Timeline.tsx index 1dc0134f3..80126ecb0 100644 --- a/apps/client/src/views/timeline/Timeline.tsx +++ b/apps/client/src/views/timeline/Timeline.tsx @@ -24,7 +24,7 @@ interface TimelineProps { export default memo(Timeline); function Timeline({ firstStart, rundown, selectedEventId, totalDuration }: TimelineProps) { const { width: screenWidth } = useViewportSize(); - const { hidePast, autosize } = useTimelineOptions(); + const { hidePast, fixedSize } = useTimelineOptions(); const selectedRef = useRef(null); const scrollContainerRef = useRef(null); @@ -38,7 +38,7 @@ function Timeline({ firstStart, rundown, selectedEventId, totalDuration }: Timel useHorizontalFollowComponent({ followRef: selectedRef, scrollRef: scrollContainerRef, - doFollow: autosize, + doFollow: !fixedSize, selectedEventId: selectedEventId, // No offset when hiding past events to ensure content starts at 0 leftOffset: hidePast ? 0 : screenWidth / 6, @@ -52,8 +52,8 @@ function Timeline({ firstStart, rundown, selectedEventId, totalDuration }: Timel duration: event.duration, })); - return calculateTimelineLayout(playableEvents, scheduleStart, scheduleEnd, screenWidth, autosize); - }, [rundown, scheduleStart, scheduleEnd, screenWidth, autosize]); + return calculateTimelineLayout(playableEvents, scheduleStart, scheduleEnd, screenWidth, !fixedSize); + }, [rundown, scheduleStart, scheduleEnd, screenWidth, fixedSize]); if (totalDuration === 0) { return null; @@ -75,7 +75,7 @@ function Timeline({ firstStart, rundown, selectedEventId, totalDuration }: Timel }); return ( -
+
{rundown.map((event, index) => { diff --git a/apps/client/src/views/timeline/timeline.options.ts b/apps/client/src/views/timeline/timeline.options.ts index b0ea293c2..bb832c738 100644 --- a/apps/client/src/views/timeline/timeline.options.ts +++ b/apps/client/src/views/timeline/timeline.options.ts @@ -22,9 +22,9 @@ export const getTimelineOptions = (timeFormat: string): ViewOption[] => { defaultValue: false, }, { - id: 'autosize', - title: 'Autosize timeline', - description: 'Timeline will adjust sizes to help with readability and automatically scroll if necessary', + id: 'fixedSize', + title: 'Fixed timeline size', + description: 'Timeline will have a fixed size to prevent scrolling', type: 'boolean', defaultValue: false, }, @@ -35,7 +35,7 @@ export const getTimelineOptions = (timeFormat: string): ViewOption[] => { type TimelineOptions = { hidePast: boolean; - autosize: boolean; + fixedSize: boolean; }; /** @@ -48,7 +48,7 @@ function getOptionsFromParams(searchParams: URLSearchParams, defaultValues?: URL return { hidePast: isStringBoolean(getValue('hidePast')), - autosize: isStringBoolean(getValue('autosize')), + fixedSize: isStringBoolean(getValue('fixedSize')), }; }