Add zoom icons to timeline (#20717)

* add icons to zoom timeline

* fix current zoom level handling

* ensure mobile buttons don't stay selected

* remove icons on event review timeline

* add tooltips
This commit is contained in:
Josh Hawkins
2025-10-29 12:04:29 -06:00
committed by GitHub
parent 62bc2aeaab
commit 901002a0a5
9 changed files with 284 additions and 144 deletions
+16 -1
View File
@@ -9,6 +9,7 @@ import {
ReviewData,
ReviewSegment,
ReviewSeverity,
ZoomLevel,
} from "@/types/review";
import { Button } from "@/components/ui/button";
import CameraActivityIndicator from "@/components/indicators/CameraActivityIndicator";
@@ -180,7 +181,7 @@ function UIPlayground() {
timestampSpread: 15,
});
const possibleZoomLevels = useMemo(
const possibleZoomLevels: ZoomLevel[] = useMemo(
() => [
{ segmentDuration: 60, timestampSpread: 15 },
{ segmentDuration: 30, timestampSpread: 5 },
@@ -196,6 +197,14 @@ function UIPlayground() {
[possibleZoomLevels],
);
const currentZoomLevel = useMemo(
() =>
possibleZoomLevels.findIndex(
(level) => level.segmentDuration === zoomSettings.segmentDuration,
),
[possibleZoomLevels, zoomSettings.segmentDuration],
);
const { zoomLevel, handleZoom, isZooming, zoomDirection } = useTimelineZoom({
zoomSettings,
zoomLevels: possibleZoomLevels,
@@ -414,6 +423,9 @@ function UIPlayground() {
dense={isMobile} // dense will produce a smaller handlebar and only minute resolution on timestamps
isZooming={isZooming} // is the timeline actively zooming?
zoomDirection={zoomDirection} // is the timeline zooming in or out
onZoomChange={handleZoomChange}
possibleZoomLevels={possibleZoomLevels}
currentZoomLevel={currentZoomLevel}
/>
)}
{isEventsReviewTimeline && (
@@ -441,6 +453,9 @@ function UIPlayground() {
dense // dense will produce a smaller handlebar and only minute resolution on timestamps
isZooming={isZooming} // is the timeline actively zooming?
zoomDirection={zoomDirection} // is the timeline zooming in or out
onZoomChange={handleZoomChange}
possibleZoomLevels={possibleZoomLevels}
currentZoomLevel={currentZoomLevel}
/>
)}
</div>