// Auteur : Simon-Pierre Boucher — contact@spboucher.ai
"use client";

import { useState } from "react";

export default function CopyKaId({ kaId }: { kaId: string }) {
  const [copied, setCopied] = useState(false);
  return (
    <button
      type="button"
      className="btn btn-ghost"
      onClick={async () => {
        try {
          await navigator.clipboard.writeText(kaId);
          setCopied(true);
          setTimeout(() => setCopied(false), 1800);
        } catch {
          /* presse-papiers indisponible */
        }
      }}
    >
      {copied ? "✓ Copié" : "Copier mon KA-ID"}
    </button>
  );
}
