From 3e9707d5072baad2cf25019ea4293ab9d3100292 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Wed, 11 Sep 2024 19:52:48 -0600 Subject: [PATCH] Add object lifecycle to explore dialog --- .../overlay/detail/ObjectLifecycle.tsx | 42 ++++++++++--------- .../overlay/detail/ReviewDetailDialog.tsx | 6 +-- .../overlay/detail/SearchDetailDialog.tsx | 22 +++++++++- 3 files changed, 44 insertions(+), 26 deletions(-) diff --git a/web/src/components/overlay/detail/ObjectLifecycle.tsx b/web/src/components/overlay/detail/ObjectLifecycle.tsx index 3cb7945ce..5110ca020 100644 --- a/web/src/components/overlay/detail/ObjectLifecycle.tsx +++ b/web/src/components/overlay/detail/ObjectLifecycle.tsx @@ -13,7 +13,7 @@ import { import { Button } from "@/components/ui/button"; import { ObjectLifecycleSequence } from "@/types/timeline"; import Heading from "@/components/ui/heading"; -import { ReviewDetailPaneType, ReviewSegment } from "@/types/review"; +import { ReviewDetailPaneType } from "@/types/review"; import { FrigateConfig } from "@/types/frigateConfig"; import { formatUnixTimestampToDateTime } from "@/utils/dateUtil"; import { getIconForLabel } from "@/utils/iconUtil"; @@ -47,14 +47,16 @@ import { AnnotationSettingsPane } from "./AnnotationSettingsPane"; import { TooltipPortal } from "@radix-ui/react-tooltip"; type ObjectLifecycleProps = { - review: ReviewSegment; + className?: string; event: Event; + showBack?: boolean; setPane: React.Dispatch>; }; export default function ObjectLifecycle({ - review, + className, event, + showBack = true, setPane, }: ObjectLifecycleProps) { const { data: eventSequence } = useSWR([ @@ -78,13 +80,13 @@ export default function ObjectLifecycle({ const getZoneColor = useCallback( (zoneName: string) => { const zoneColor = - config?.cameras?.[review.camera]?.zones?.[zoneName]?.color; + config?.cameras?.[event.camera]?.zones?.[zoneName]?.color; if (zoneColor) { const reversed = [...zoneColor].reverse(); return reversed; } }, - [config, review], + [config, event], ); const getZonePolygon = useCallback( @@ -93,7 +95,7 @@ export default function ObjectLifecycle({ return; } const zonePoints = - config?.cameras[review.camera].zones[zoneName].coordinates; + config?.cameras[event.camera].zones[zoneName].coordinates; const imgElement = imgRef.current; const imgRect = imgElement.getBoundingClientRect(); @@ -110,7 +112,7 @@ export default function ObjectLifecycle({ }, [] as number[]) .join(","); }, - [config, imgRef, review], + [config, imgRef, event], ); const [boxStyle, setBoxStyle] = useState(null); @@ -224,17 +226,19 @@ export default function ObjectLifecycle({ } return ( - <> -
- -
+
+ {showBack && ( +
+ +
+ )}
- +
); } diff --git a/web/src/components/overlay/detail/ReviewDetailDialog.tsx b/web/src/components/overlay/detail/ReviewDetailDialog.tsx index 4b6812cf7..afae0f76a 100644 --- a/web/src/components/overlay/detail/ReviewDetailDialog.tsx +++ b/web/src/components/overlay/detail/ReviewDetailDialog.tsx @@ -214,11 +214,7 @@ export default function ReviewDetailDialog({ {pane == "details" && selectedEvent && (
- +
)} diff --git a/web/src/components/overlay/detail/SearchDetailDialog.tsx b/web/src/components/overlay/detail/SearchDetailDialog.tsx index a67ec3b4a..373c887ed 100644 --- a/web/src/components/overlay/detail/SearchDetailDialog.tsx +++ b/web/src/components/overlay/detail/SearchDetailDialog.tsx @@ -36,8 +36,15 @@ import ActivityIndicator from "@/components/indicators/activity-indicator"; import { ASPECT_VERTICAL_LAYOUT, ASPECT_WIDE_LAYOUT } from "@/types/record"; import { FaRegListAlt, FaVideo } from "react-icons/fa"; import FrigatePlusIcon from "@/components/icons/FrigatePlusIcon"; +import { FaRotate } from "react-icons/fa6"; +import ObjectLifecycle from "./ObjectLifecycle"; -const SEARCH_TABS = ["details", "frigate+", "video"] as const; +const SEARCH_TABS = [ + "details", + "frigate+", + "video", + "object lifecycle", +] as const; type SearchTab = (typeof SEARCH_TABS)[number]; type SearchDetailDialogProps = { @@ -104,7 +111,7 @@ export default function SearchDetailDialog({ @@ -138,6 +145,9 @@ export default function SearchDetailDialog({ {item == "details" && } {item == "frigate+" && } {item == "video" && } + {item == "object lifecycle" && ( + + )}
{item}
))} @@ -164,6 +174,14 @@ export default function SearchDetailDialog({ /> )} {page == "video" && } + {page == "object lifecycle" && ( + {}} + /> + )}
);