import { Download } from "lucide-react"; import { useId, useState } from "react"; import { useTranslation } from "react-i18next"; import { Button } from "@/components/ui/button"; import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"; import { cn } from "@/lib/utils"; import type { UpdateMethod } from "@/lib/api"; export function UpdateNotice({ version, collapsed = false, onOpen, onDismiss, onRequestUpdate, installationMethod }: { version: string; collapsed?: boolean; onOpen: () => void; onDismiss: () => void; /** Opens the host's update confirmation, never installs from the entry itself. */ onRequestUpdate?: () => void; installationMethod?: UpdateMethod | null; }) { const { t } = useTranslation(); const [open, setOpen] = useState(false); const titleId = useId(); const methodLabel = installationMethod && installationMethod !== "managed" ? t("updates.guide.entry", { method: t(`updates.guide.methods.${installationMethod}`) }) : null; const label = [t("settings.about.updateAvailable", { version }), methodLabel].filter(Boolean).join(" ยท "); const button = ; return
{onRequestUpdate ? {button} {label} : {collapsed ? {button} {!open && {label}} : {button}}

{label}

}
; }