"use client"; import { useState } from "react"; import { copyText } from "@/lib/clipboard"; export default function CopyLinkButton({ token }: { token: string }) { const [copied, setCopied] = useState(false); async function copy() { const url = `${window.location.origin}/files/${token}`; try { await copyText(url); setCopied(true); setTimeout(() => setCopied(false), 2500); } catch { // copy completely unavailable (e.g. sandboxed iframe) — do nothing } } return ( ); }