Skip to content

NVR with realtime local object detection for IP cameras

Add ability to use carousel buttons to scroll through object lifecycle elements (#14662)

Josh Hawkinse67b7a6d5e6a
diff --git a/web/src/components/overlay/detail/ObjectLifecycle.tsx b/web/src/components/overlay/detail/ObjectLifecycle.tsx
index bb80b5c7f1..fee15af4a2 100644
--- a/web/src/components/overlay/detail/ObjectLifecycle.tsx
+++ b/web/src/components/overlay/detail/ObjectLifecycle.tsx
@@ -203,6 +203,20 @@ export default function ObjectLifecycle({
setCurrent(index);
};
+ const handleThumbnailNavigation = useCallback(
+ (direction: "next" | "previous") => {
+ if (!mainApi || !thumbnailApi || !eventSequence) return;
+ const newIndex =
+ direction === "next"
+ ? Math.min(current + 1, eventSequence.length - 1)
+ : Math.max(current - 1, 0);
+ mainApi.scrollTo(newIndex);
+ thumbnailApi.scrollTo(newIndex);
+ setCurrent(newIndex);
+ },
+ [mainApi, thumbnailApi, current, eventSequence],
+ );
+
useEffect(() => {
if (eventSequence && eventSequence.length > 0) {
setTimeIndex(eventSequence?.[current].timestamp);
@@ -545,8 +559,14 @@ export default function ObjectLifecycle({
</CarouselItem>
))}
</CarouselContent>
- <CarouselPrevious />
- <CarouselNext />
+ <CarouselPrevious
+ disabled={current === 0}
+ onClick={() => handleThumbnailNavigation("previous")}
+ />
+ <CarouselNext
+ disabled={current === eventSequence.length - 1}
+ onClick={() => handleThumbnailNavigation("next")}
+ />
</Carousel>
</div>
</div>