From 7db3618fc79021d9b5512a7d7d6154bcd95e1c26 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Thu, 9 Apr 2026 09:09:48 -0500 Subject: [PATCH] display label and camera on attachment chip --- .../components/chat/ChatAttachmentChip.tsx | 43 ++++++++++++++----- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/web/src/components/chat/ChatAttachmentChip.tsx b/web/src/components/chat/ChatAttachmentChip.tsx index 30891db429..5894efaa77 100644 --- a/web/src/components/chat/ChatAttachmentChip.tsx +++ b/web/src/components/chat/ChatAttachmentChip.tsx @@ -1,5 +1,7 @@ import { useApiHost } from "@/api"; +import { useCameraFriendlyName } from "@/hooks/use-camera-friendly-name"; import { useTranslation } from "react-i18next"; +import useSWR from "swr"; import { LuX, LuExternalLink } from "react-icons/lu"; import { Button } from "@/components/ui/button"; import { @@ -7,7 +9,9 @@ import { TooltipContent, TooltipTrigger, } from "@/components/ui/tooltip"; +import ActivityIndicator from "@/components/indicators/activity-indicator"; import { cn } from "@/lib/utils"; +import { getTranslatedLabel } from "@/utils/i18n"; type ChatAttachmentChipProps = { eventId: string; @@ -17,8 +21,8 @@ type ChatAttachmentChipProps = { /** * Small horizontal chip rendering an event as an "attachment": a thumbnail, - * a short label, an optional remove X (composer mode), and an external-link - * icon that opens the event in Explore. + * a friendly label like "Person on driveway", an optional remove X (composer + * mode), and an external-link icon that opens the event in Explore. */ export function ChatAttachmentChip({ eventId, @@ -28,6 +32,18 @@ export function ChatAttachmentChip({ const apiHost = useApiHost(); const { t } = useTranslation(["views/chat"]); + const { data: eventData } = useSWR<{ label: string; camera: string }[]>( + `event_ids?ids=${eventId}`, + ); + const evt = eventData?.[0]; + const cameraName = useCameraFriendlyName(evt?.camera); + const displayLabel = evt + ? t("attachment_chip_label", { + label: getTranslatedLabel(evt.label), + camera: cameraName, + }) + : eventId; + return (
- - {eventId} - + {evt ? ( + + {displayLabel} + + ) : ( +