+
);
}
diff --git a/web/src/views/events/EventView.tsx b/web/src/views/events/EventView.tsx
index 24cf7aa84..eaae92a0f 100644
--- a/web/src/views/events/EventView.tsx
+++ b/web/src/views/events/EventView.tsx
@@ -85,7 +85,7 @@ export default function EventView({
}
if (!summary) {
- return { alert: 0, detection: 0, significant_motion: 0 };
+ return { alert: -1, detection: -1, significant_motion: -1 };
}
if (filter?.showReviewed == 1) {
@@ -106,6 +106,10 @@ export default function EventView({
// review paging
const reviewItems = useMemo(() => {
+ if (!reviews) {
+ return undefined;
+ }
+
const all: ReviewSegment[] = [];
const alerts: ReviewSegment[] = [];
const detections: ReviewSegment[] = [];
@@ -167,7 +171,7 @@ export default function EventView({
const exportReview = useCallback(
(id: string) => {
- const review = reviewItems.all?.find((seg) => seg.id == id);
+ const review = reviewItems?.all?.find((seg) => seg.id == id);
if (!review) {
return;
@@ -206,7 +210,9 @@ export default function EventView({
aria-label="Select alerts"
>
-
Alerts ∙ {reviewCounts.alert}
+
+ Alerts{` ∙ ${reviewCounts.alert > -1 ? reviewCounts.alert : ""}`}
+
- Detections ∙ {reviewCounts.detection}
+ Detections
+ {` ∙ ${reviewCounts.detection > -1 ? reviewCounts.detection : ""}`}
;
- reviewItems: {
+ reviewItems?: {
all: ReviewSegment[];
alert: ReviewSegment[];
detection: ReviewSegment[];
@@ -310,10 +317,14 @@ function DetectionReview({
// review data
const currentItems = useMemo(() => {
+ if (!reviewItems) {
+ return null;
+ }
+
const current = reviewItems[severity];
if (!current || current.length == 0) {
- return null;
+ return [];
}
if (filter?.showReviewed != 1) {
@@ -323,7 +334,7 @@ function DetectionReview({
}
// only refresh when severity or filter changes
// eslint-disable-next-line react-hooks/exhaustive-deps
- }, [severity, filter, reviewItems.all.length]);
+ }, [severity, filter, reviewItems?.all.length]);
// preview
@@ -348,7 +359,7 @@ function DetectionReview({
// timeline interaction
const { alignStartDateToTimeline } = useEventUtils(
- reviewItems.all,
+ reviewItems?.all ?? [],
segmentDuration,
);
@@ -441,10 +452,16 @@ function DetectionReview({
/>
)}
- {itemsToReview == 0 && (
-
+ {!currentItems && (
+
+ )}
+
+ {currentItems?.length === 0 && (
+
- There are no {severity.replace(/_/g, " ")} items to review
+ There are no {severity.replace(/_/g, " ")}s to review
)}
@@ -479,7 +496,7 @@ function DetectionReview({
);
})}
- {(itemsToReview ?? 0) > 0 && (
+ {(currentItems?.length ?? 0) > 0 && (itemsToReview ?? 0) > 0 && (
@@ -514,7 +531,7 @@ function DetectionReview({
type MotionReviewProps = {
contentRef: MutableRefObject
;
- reviewItems: {
+ reviewItems?: {
all: ReviewSegment[];
alert: ReviewSegment[];
detection: ReviewSegment[];
@@ -680,7 +697,7 @@ function MotionReview({
showHandlebar
handlebarTime={currentTime}
setHandlebarTime={setCurrentTime}
- events={reviewItems.all}
+ events={reviewItems?.all ?? []}
motion_events={motionData ?? []}
severityType="significant_motion"
contentRef={contentRef}
diff --git a/web/src/views/events/RecordingView.tsx b/web/src/views/events/RecordingView.tsx
index 737caec82..857c5de04 100644
--- a/web/src/views/events/RecordingView.tsx
+++ b/web/src/views/events/RecordingView.tsx
@@ -366,7 +366,7 @@ export function MobileRecordingView({
return (