"use client"; import { useState } from "react"; import { Copy, Check } from "lucide-react"; import { logToolUsage } from "@/lib/actions/tool-usage"; import type { ToolId } from "@/lib/tools/_shared/types"; export function CopyButton({ text, tool }: { text: string; tool: ToolId }) { const [copied, setCopied] = useState(false); async function onCopy() { try { await navigator.clipboard.writeText(text); } catch { return; // буфер недоступен (нет разрешения / insecure context) — молча } setCopied(true); logToolUsage({ tool }).catch(() => {}); // аналитика — best-effort, не роняем UI setTimeout(() => setCopied(false), 1500); } return ( ); }