diff --git a/frigate/timeline.py b/frigate/timeline.py index 8e6aedc67..ae4abb447 100644 --- a/frigate/timeline.py +++ b/frigate/timeline.py @@ -131,6 +131,19 @@ class TimelineProcessor(threading.Thread): ): timeline_entry[Timeline.class_type] = "entered_zone" timeline_entry[Timeline.data]["zones"] = event_data["current_zones"] + + zones_friendly = [] + for z in event_data["current_zones"]: + zone_cfg = camera_config.zones.get(z) + if zone_cfg is not None and getattr( + zone_cfg, "friendly_name", None + ): + zones_friendly.append(zone_cfg.friendly_name) + else: + zones_friendly.append(z) + + timeline_entry[Timeline.data]["zones_friendly_names"] = zones_friendly + save = True elif prev_event_data["stationary"] != event_data["stationary"]: timeline_entry[Timeline.class_type] = ( diff --git a/web/src/components/overlay/detail/ObjectPath.tsx b/web/src/components/overlay/detail/ObjectPath.tsx index f160f092a..7f43fb2c7 100644 --- a/web/src/components/overlay/detail/ObjectPath.tsx +++ b/web/src/components/overlay/detail/ObjectPath.tsx @@ -8,9 +8,6 @@ import { import { TooltipPortal } from "@radix-ui/react-tooltip"; import { getLifecycleItemDescription } from "@/utils/lifecycleUtil"; import { useTranslation } from "react-i18next"; -import { resolveZoneName } from "@/hooks/use-zone-friendly-name"; -import { FrigateConfig } from "@/types/frigateConfig"; -import useSWR from "swr"; type ObjectPathProps = { positions?: Position[]; @@ -45,30 +42,16 @@ export function ObjectPath({ visible = true, }: ObjectPathProps) { const { t } = useTranslation(["views/explore"]); - const { data: config } = useSWR("config"); const getAbsolutePositions = useCallback(() => { if (!imgRef.current || !positions) return []; const imgRect = imgRef.current.getBoundingClientRect(); - return positions.map((pos) => { - if (config && pos.lifecycle_item?.data?.zones) { - pos.lifecycle_item = { - ...pos.lifecycle_item, - data: { - ...pos.lifecycle_item.data, - zones_friendly_names: pos.lifecycle_item.data.zones.map((zone) => { - return resolveZoneName(config, zone); - }), - }, - }; - } - return { - x: pos.x * imgRect.width, - y: pos.y * imgRect.height, - timestamp: pos.timestamp, - lifecycle_item: pos.lifecycle_item, - }; - }); - }, [imgRef, positions, config]); + return positions.map((pos) => ({ + x: pos.x * imgRect.width, + y: pos.y * imgRect.height, + timestamp: pos.timestamp, + lifecycle_item: pos.lifecycle_item, + })); + }, [positions, imgRef]); const generateStraightPath = useCallback((points: Position[]) => { if (!points || points.length < 2) return ""; diff --git a/web/src/components/settings/PolygonCanvas.tsx b/web/src/components/settings/PolygonCanvas.tsx index e2809d332..307393eae 100644 --- a/web/src/components/settings/PolygonCanvas.tsx +++ b/web/src/components/settings/PolygonCanvas.tsx @@ -269,6 +269,10 @@ export function PolygonCanvas({ const updatedPolygons = [...polygons]; const activePolygon = updatedPolygons[activePolygonIndex]; + if (!activePolygon) { + return; + } + // add default points order for already completed polygons if (!activePolygon.pointsOrder && activePolygon.isFinished) { updatedPolygons[activePolygonIndex] = { diff --git a/web/src/components/timeline/DetailStream.tsx b/web/src/components/timeline/DetailStream.tsx index 099ea234b..4b152aadb 100644 --- a/web/src/components/timeline/DetailStream.tsx +++ b/web/src/components/timeline/DetailStream.tsx @@ -31,7 +31,6 @@ import { Link } from "react-router-dom"; import { Switch } from "@/components/ui/switch"; import { usePersistence } from "@/hooks/use-persistence"; import { isDesktop } from "react-device-detect"; -import { resolveZoneName } from "@/hooks/use-zone-friendly-name"; type DetailStreamProps = { reviewItems?: ReviewSegment[]; @@ -655,16 +654,6 @@ function LifecycleItem({ const { t } = useTranslation("views/events"); const { data: config } = useSWR("config"); - item = { - ...item, - data: { - ...item.data, - zones_friendly_names: item?.data?.zones?.map((zone) => { - return resolveZoneName(config, zone); - }), - }, - }; - const aspectRatio = useMemo(() => { if (!config || !item?.camera) { return 16 / 9;