From ed9c67804a33e93db518a487cbf27624e4b6c779 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Tue, 12 Nov 2024 06:37:25 -0600 Subject: [PATCH] UI fixes (#14933) * Fix plus dialog * Remove activity indicator on review item download button * fix explore view --- .../components/button/DownloadVideoButton.tsx | 16 +- .../components/card/SearchThumbnailFooter.tsx | 3 + .../components/menu/SearchResultActions.tsx | 22 +-- .../overlay/detail/ReviewDetailDialog.tsx | 2 +- .../overlay/detail/SearchDetailDialog.tsx | 2 +- .../overlay/dialog/FrigatePlusDialog.tsx | 176 +++--------------- web/src/views/explore/ExploreView.tsx | 5 + web/src/views/search/SearchView.tsx | 3 + 8 files changed, 44 insertions(+), 185 deletions(-) diff --git a/web/src/components/button/DownloadVideoButton.tsx b/web/src/components/button/DownloadVideoButton.tsx index 7545217bf..750b35607 100644 --- a/web/src/components/button/DownloadVideoButton.tsx +++ b/web/src/components/button/DownloadVideoButton.tsx @@ -1,7 +1,5 @@ -import { useState } from "react"; import { Button } from "@/components/ui/button"; import { toast } from "sonner"; -import ActivityIndicator from "../indicators/activity-indicator"; import { FaDownload } from "react-icons/fa"; import { formatUnixTimestampToDateTime } from "@/utils/dateUtil"; import { cn } from "@/lib/utils"; @@ -19,8 +17,6 @@ export function DownloadVideoButton({ startTime, className, }: DownloadVideoButtonProps) { - const [isDownloading, setIsDownloading] = useState(false); - const formattedDate = formatUnixTimestampToDateTime(startTime, { strftime_fmt: "%D-%T", time_style: "medium", @@ -29,7 +25,6 @@ export function DownloadVideoButton({ const filename = `${camera}_${formattedDate}.mp4`; const handleDownloadStart = () => { - setIsDownloading(true); toast.success("Your review item video has started downloading.", { position: "top-center", }); @@ -39,19 +34,14 @@ export function DownloadVideoButton({
diff --git a/web/src/components/card/SearchThumbnailFooter.tsx b/web/src/components/card/SearchThumbnailFooter.tsx index b959a82c5..33db0c598 100644 --- a/web/src/components/card/SearchThumbnailFooter.tsx +++ b/web/src/components/card/SearchThumbnailFooter.tsx @@ -13,6 +13,7 @@ type SearchThumbnailProps = { findSimilar: () => void; refreshResults: () => void; showObjectLifecycle: () => void; + showSnapshot: () => void; }; export default function SearchThumbnailFooter({ @@ -21,6 +22,7 @@ export default function SearchThumbnailFooter({ findSimilar, refreshResults, showObjectLifecycle, + showSnapshot, }: SearchThumbnailProps) { const { data: config } = useSWR("config"); @@ -54,6 +56,7 @@ export default function SearchThumbnailFooter({ findSimilar={findSimilar} refreshResults={refreshResults} showObjectLifecycle={showObjectLifecycle} + showSnapshot={showSnapshot} /> diff --git a/web/src/components/menu/SearchResultActions.tsx b/web/src/components/menu/SearchResultActions.tsx index a07d27240..10f0ed623 100644 --- a/web/src/components/menu/SearchResultActions.tsx +++ b/web/src/components/menu/SearchResultActions.tsx @@ -37,15 +37,14 @@ import { TooltipContent, TooltipTrigger, } from "@/components/ui/tooltip"; -import { FrigatePlusDialog } from "@/components/overlay/dialog/FrigatePlusDialog"; import useSWR from "swr"; -import { Event } from "@/types/event"; type SearchResultActionsProps = { searchResult: SearchResult; findSimilar: () => void; refreshResults: () => void; showObjectLifecycle: () => void; + showSnapshot: () => void; isContextMenu?: boolean; children?: ReactNode; }; @@ -55,12 +54,12 @@ export default function SearchResultActions({ findSimilar, refreshResults, showObjectLifecycle, + showSnapshot, isContextMenu = false, children, }: SearchResultActionsProps) { const { data: config } = useSWR("config"); - const [showFrigatePlus, setShowFrigatePlus] = useState(false); const [deleteDialogOpen, setDeleteDialogOpen] = useState(false); const handleDelete = () => { @@ -130,10 +129,7 @@ export default function SearchResultActions({ searchResult.has_snapshot && searchResult.end_time && !searchResult.plus_id && ( - setShowFrigatePlus(true)} - > + Submit to Frigate+ @@ -178,16 +174,6 @@ export default function SearchResultActions({ - setShowFrigatePlus(false)} - onEventUploaded={() => { - searchResult.plus_id = "submitted"; - }} - /> - {isContextMenu ? ( {children} @@ -216,7 +202,7 @@ export default function SearchResultActions({ setShowFrigatePlus(true)} + onClick={showSnapshot} /> Submit to Frigate+ diff --git a/web/src/components/overlay/detail/ReviewDetailDialog.tsx b/web/src/components/overlay/detail/ReviewDetailDialog.tsx index d40f68a1e..74a9950b9 100644 --- a/web/src/components/overlay/detail/ReviewDetailDialog.tsx +++ b/web/src/components/overlay/detail/ReviewDetailDialog.tsx @@ -161,7 +161,7 @@ export default function ReviewDetailDialog({ )} > - + - )} - - - - )} - {state == "uploading" && } - - - - ); - + if (!upload) { + return; + } if (dialog) { return ( (!open ? onClose() : null)} > - - {content} + + + Submit to Frigate+ + + Submit this snapshot to Frigate+ + + + ); } - - return content; } diff --git a/web/src/views/explore/ExploreView.tsx b/web/src/views/explore/ExploreView.tsx index 00ed19ab2..f37c37453 100644 --- a/web/src/views/explore/ExploreView.tsx +++ b/web/src/views/explore/ExploreView.tsx @@ -228,12 +228,17 @@ function ExploreThumbnailImage({ onSelectSearch(event, 0, "object lifecycle"); }; + const handleShowSnapshot = () => { + onSelectSearch(event, 0, "snapshot"); + }; + return (
diff --git a/web/src/views/search/SearchView.tsx b/web/src/views/search/SearchView.tsx index 10ec2e02e..378b313e0 100644 --- a/web/src/views/search/SearchView.tsx +++ b/web/src/views/search/SearchView.tsx @@ -471,6 +471,9 @@ export default function SearchView({ showObjectLifecycle={() => onSelectSearch(value, index, "object lifecycle") } + showSnapshot={() => + onSelectSearch(value, index, "snapshot") + } />