add tooltip

This commit is contained in:
Josh Hawkins 2026-04-09 09:09:25 -05:00
parent b1b43884b8
commit 925541cbd8
2 changed files with 21 additions and 15 deletions

View File

@ -12,6 +12,7 @@
"result": "Result", "result": "Result",
"arguments": "Arguments:", "arguments": "Arguments:",
"response": "Response:", "response": "Response:",
"attachment_chip_label": "{{label}} on {{camera}}",
"attachment_chip_remove": "Remove attachment", "attachment_chip_remove": "Remove attachment",
"open_in_explore": "Open in Explore", "open_in_explore": "Open in Explore",
"attach_event_aria": "Attach event {{eventId}}", "attach_event_aria": "Attach event {{eventId}}",

View File

@ -1,6 +1,11 @@
import { useApiHost } from "@/api"; import { useApiHost } from "@/api";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { LuExternalLink } from "react-icons/lu"; import { LuExternalLink } from "react-icons/lu";
import {
Tooltip,
TooltipContent,
TooltipTrigger,
} from "@/components/ui/tooltip";
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
type ChatEvent = { id: string; score?: number }; type ChatEvent = { id: string; score?: number };
@ -50,21 +55,21 @@ export function ChatEventThumbnailsRow({
loading="lazy" loading="lazy"
/> />
</button> </button>
<a <Tooltip>
href={`/explore?event_id=${event.id}`} <TooltipTrigger asChild>
target="_blank" <a
rel="noopener noreferrer" href={`/explore?event_id=${event.id}`}
onClick={(e) => e.stopPropagation()} target="_blank"
className="absolute right-1 top-1 flex size-6 items-center justify-center rounded bg-black/60 text-white hover:bg-black/80" rel="noopener noreferrer"
aria-label={t("open_in_explore")} onClick={(e) => e.stopPropagation()}
> className="absolute right-1 top-1 flex size-6 items-center justify-center rounded bg-black/60 text-white hover:bg-black/80"
<LuExternalLink className="size-3" /> aria-label={t("open_in_explore")}
</a> >
{typeof event.score === "number" && !isAnchor && ( <LuExternalLink className="size-3" />
<span className="pointer-events-none absolute bottom-1 right-1 rounded bg-black/60 px-1 text-[10px] text-white"> </a>
{Math.round(event.score * 100)}% </TooltipTrigger>
</span> <TooltipContent>{t("open_in_explore")}</TooltipContent>
)} </Tooltip>
{isAnchor && ( {isAnchor && (
<span className="pointer-events-none absolute left-1 top-1 rounded bg-primary px-1 text-[10px] text-primary-foreground"> <span className="pointer-events-none absolute left-1 top-1 rounded bg-primary px-1 text-[10px] text-primary-foreground">
{t("anchor")} {t("anchor")}