From 90c60000d075f8f2f1fc9777fee50b8d90a532b9 Mon Sep 17 00:00:00 2001
From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>
Date: Tue, 15 Oct 2024 07:58:08 -0500
Subject: [PATCH] delete confirmation
---
.../components/card/SearchThumbnailFooter.tsx | 41 +++++++++++++++++--
1 file changed, 37 insertions(+), 4 deletions(-)
diff --git a/web/src/components/card/SearchThumbnailFooter.tsx b/web/src/components/card/SearchThumbnailFooter.tsx
index cb4915e7f..2aa993665 100644
--- a/web/src/components/card/SearchThumbnailFooter.tsx
+++ b/web/src/components/card/SearchThumbnailFooter.tsx
@@ -12,6 +12,16 @@ import {
DropdownMenuItem,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
+import {
+ AlertDialog,
+ AlertDialogAction,
+ AlertDialogCancel,
+ AlertDialogContent,
+ AlertDialogDescription,
+ AlertDialogFooter,
+ AlertDialogHeader,
+ AlertDialogTitle,
+} from "../ui/alert-dialog";
import {
LuCamera,
LuDownload,
@@ -45,20 +55,21 @@ export default function SearchThumbnailFooter({
// interactions
const [showFrigatePlus, setShowFrigatePlus] = useState(false);
+ const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);
const handleDelete = useCallback(() => {
axios
.delete(`events/${searchResult.id}`)
.then((resp) => {
if (resp.status == 200) {
- toast.success("Deleted object successfully.", {
+ toast.success("Tracked object deleted successfully.", {
position: "top-center",
});
refreshResults();
}
})
.catch(() => {
- toast.error("Failed to delete object.", {
+ toast.error("Failed to delete tracked object.", {
position: "top-center",
});
});
@@ -74,6 +85,28 @@ export default function SearchThumbnailFooter({
return (
<>
+ setDeleteDialogOpen(!deleteDialogOpen)}
+ >
+
+
+ Confirm Delete
+
+
+ Are you sure you want to delete this tracked object?
+
+
+ Cancel
+
+ Delete
+
+
+
+
-
+
{searchResult.has_clip && (
View object lifecycle
-
+ setDeleteDialogOpen(true)}>
Delete