UI changes (#10651)

* Check if event time is in segment

* conditionally render minimap bounds for event segments
This commit is contained in:
Josh Hawkins
2024-03-24 12:39:28 -05:00
committed by GitHub
parent 0fda7147be
commit 37f60f7140
5 changed files with 53 additions and 35 deletions

View File

@@ -758,21 +758,26 @@ function MotionReview({
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [playing, playbackRate]);
const { alignStartDateToTimeline } = useTimelineUtils({
segmentDuration,
});
const getDetectionType = useCallback(
(cameraName: string) => {
if (motionOnly) {
return null;
}
const segmentTime = alignStartDateToTimeline(currentTime);
const matchingItem = reviewItems?.all.find(
(item) =>
currentTime >= item.start_time &&
currentTime <= item.end_time &&
item.start_time >= segmentTime &&
item.end_time <= segmentTime + segmentDuration &&
item.camera === cameraName,
);
return matchingItem ? matchingItem.severity : null;
},
[reviewItems, currentTime, motionOnly],
[reviewItems, currentTime, motionOnly, alignStartDateToTimeline],
);
if (!relevantPreviews) {