"use client"; import type { ReactElement } from "react"; import Image from "next/image"; import Link from "next/link"; import { DownloadIcon, SquareDashedIcon, TypeIcon } from "lucide-react"; import { toast } from "sonner"; import { ContextMenu, ContextMenuContent, ContextMenuItem, ContextMenuSeparator, ContextMenuTrigger, } from "@/components/ui/context-menu"; import { cn } from "@/lib/utils"; type BrandAssetsMenuProps = { children: ReactElement; }; type HeaderBrandLinkProps = { className?: string; labelClassName?: string; }; export function HeaderBrandLink({ className, labelClassName, }: HeaderBrandLinkProps) { return ( assistant-ui logo assistant-ui ); } function BrandAssetsMenu({ children }: BrandAssetsMenuProps) { return ( {children} void copySvg("Logomark as SVG", "/favicon/icon.svg")} > Copy Logomark as SVG void copySvg("Logotype as SVG", "/brand/logotype.svg") } > Copy Logotype as SVG Brand Guidelines Download Brand Assets ); } // ClipboardItem wraps the pending fetch so the clipboard write starts inside // the user activation window; Safari rejects a write that awaits the fetch. const copySvg = async (label: string, path: string) => { try { const svg = fetch(path).then(async (response) => { if (!response.ok) throw new Error("Failed to load SVG"); return new Blob([await response.text()], { type: "text/plain" }); }); await navigator.clipboard.write([new ClipboardItem({ "text/plain": svg })]); toast.success(`${label} copied`); } catch { toast.error(`Failed to copy ${label.toLowerCase()}`); } };