From 8e7b83d2f1cdc1f7645065c012d0b7ba5165eb92 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Wed, 31 Jul 2024 15:08:07 -0500 Subject: [PATCH] Display messages when no events exist (#12694) * Display message in desktop events list when no events exist * Add message for when no events are found on plus view * validating check * activity indicator check * clarify error message --- web/src/pages/SubmitPlus.tsx | 185 +++++++++++++------------ web/src/views/events/RecordingView.tsx | 42 +++--- 2 files changed, 121 insertions(+), 106 deletions(-) diff --git a/web/src/pages/SubmitPlus.tsx b/web/src/pages/SubmitPlus.tsx index c1a89dc45..57c0fdf37 100644 --- a/web/src/pages/SubmitPlus.tsx +++ b/web/src/pages/SubmitPlus.tsx @@ -43,6 +43,7 @@ import { FaSortAmountDown, FaSortAmountUp, } from "react-icons/fa"; +import { LuFolderX } from "react-icons/lu"; import { PiSlidersHorizontalFill } from "react-icons/pi"; import useSWR from "swr"; import useSWRInfinite from "swr/infinite"; @@ -240,96 +241,104 @@ export default function SubmitPlus() {
-
- (!open ? setUpload(undefined) : null)} - > - - - Submit To Frigate+ - - Objects in locations you want to avoid are not false - positives. Submitting them as false positives will confuse the - model. - - - {`${upload?.label}`} - - - - - - - - - {events?.map((event) => { - if (event.data.type != "object" || event.plus_id) { - return; - } - - return ( -
setUpload(event)} - > -
- -
- -
- - {[event.label].map((object) => { - return getIconForLabel( - object, - "size-3 text-white", - ); - })} -
- {Math.round(event.data.score * 100)}% -
-
-
-
-
- - {[event.label] - .map((text) => capitalizeFirstLetter(text)) - .sort() - .join(", ") - .replaceAll("-verified", "")} - -
-
+ {isValidating ? ( + + ) : events?.length === 0 ? ( +
+ + No snapshots found +
+ ) : ( +
+ (!open ? setUpload(undefined) : null)} + > + + + Submit To Frigate+ + + Objects in locations you want to avoid are not false + positives. Submitting them as false positives will confuse + the model. + + {`${upload?.label}`} -
- ); - })} - {!isValidating && !isDone &&
} - {isValidating && } -
+ + + + + + + + + {events?.map((event) => { + if (event.data.type != "object" || event.plus_id) { + return; + } + + return ( +
setUpload(event)} + > +
+ +
+ +
+ + {[event.label].map((object) => { + return getIconForLabel( + object, + "size-3 text-white", + ); + })} +
+ {Math.round(event.data.score * 100)}% +
+
+
+
+
+ + {[event.label] + .map((text) => capitalizeFirstLetter(text)) + .sort() + .join(", ") + .replaceAll("-verified", "")} + +
+
+ +
+ ); + })} + {!isValidating && !isDone &&
} +
+ )}
); diff --git a/web/src/views/events/RecordingView.tsx b/web/src/views/events/RecordingView.tsx index 2613069de..ce416b873 100644 --- a/web/src/views/events/RecordingView.tsx +++ b/web/src/views/events/RecordingView.tsx @@ -708,25 +708,31 @@ function Timeline({ isMobile && "sm:grid-cols-2", )} > - {mainCameraReviewItems.map((review) => { - if (review.severity == "significant_motion") { - return; - } + {mainCameraReviewItems.length === 0 ? ( +
+ No events found for this time period. +
+ ) : ( + mainCameraReviewItems.map((review) => { + if (review.severity === "significant_motion") { + return; + } - return ( - { - manuallySetCurrentTime( - review.start_time - REVIEW_PADDING, - true, - ); - }} - /> - ); - })} + return ( + { + manuallySetCurrentTime( + review.start_time - REVIEW_PADDING, + true, + ); + }} + /> + ); + }) + )}
)}