"use client"; import { useState } from "react"; import { Copy, Check, KeyRound, TriangleAlert } from "lucide-react"; import { Button } from "@/components/ui"; import { cn } from "@/lib/utils"; const NOTICE = "Save this recovery code. Spinza does not collect your email address. If you lose your password and recovery code, your account cannot be recovered."; /** Prominent recovery-code display with copy button and a save-confirmation gate. */ export function RecoveryCodePanel({ code, title = "Your recovery code", notice = NOTICE, continueLabel = "Continue", onContinue, loading, className, hideHeader }: { code: string; title?: string; notice?: string; continueLabel?: string; onContinue: () => void; loading?: boolean; className?: string; hideHeader?: boolean }) { const [copied, setCopied] = useState(false); const [saved, setSaved] = useState(false); const copy = async () => { try { await navigator.clipboard.writeText(code); setCopied(true); setTimeout(() => setCopied(false), 1800); } catch { // Clipboard unavailable (insecure context): user can still select the code. } }; return (
{hideHeader ? null : (

{title}

This code is the only way to reset your password.

)}
Recovery code
{code}

{notice}

); }