This commit is contained in:
Freja R 2026-03-28 19:07:54 +01:00 committed by GitHub
commit f4a1777db7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 3 deletions

View File

@ -23,6 +23,7 @@ import {
ContextMenuItem,
ContextMenuTrigger,
} from "./ui/context-menu";
import { toast } from "sonner";
export function Header() {
const [isMenuOpen, setIsMenuOpen] = useState(false);
@ -66,9 +67,17 @@ export function Header() {
<ContextMenuContent>
<ContextMenuItem
onClick={async () => {
const res = await fetch(DEFAULT_LOGO_URL);
const svg = await res.text();
await navigator.clipboard.writeText(svg);
try {
const response = await fetch(DEFAULT_LOGO_URL);
if (!response.ok) {
throw new Error(`Failed to fetch SVG: ${response.status}`);
}
const svg = await response.text();
await navigator.clipboard.writeText(svg);
toast.success("SVG copied to clipboard");
} catch {
toast.error("Failed to copy SVG to clipboard");
}
}}
>
<HugeiconsIcon icon={Copy01Icon} />