import { useState } from 'react'; import { TriangleAlert } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Checkbox } from '@/components/ui/checkbox'; import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from '@/components/ui/dialog'; // The recovery phrase, shown exactly once. // // The sidecar returns `mnemonic` on the create response and only when IT generated the seed. There is no // second chance without the passphrase (settings → export seed), so this modal cannot be dismissed by // clicking away, pressing Escape, or anything short of ticking the box and pressing the button. // // The words arrive as a prop, live in this component's render only, and are never written to React Query, // localStorage, sessionStorage, the URL, or a clipboard helper. Closing the modal is the only exit and it // drops the string on the floor. There is deliberately no "copy" button: a seed on the clipboard is a seed // in every clipboard manager on the machine. type SeedBackupDialogProps = { open: boolean; mnemonic: string; walletName: string; onConfirmed: () => void; }; export const SeedBackupDialog = ({ open, mnemonic, walletName, onConfirmed }: SeedBackupDialogProps) => { const [acknowledged, setAcknowledged] = useState(false); const words = mnemonic.trim().split(/\s+/); const confirm = () => { setAcknowledged(false); onConfirmed(); }; return ( {/* `[&>button]:hidden` drops the shared X — with no onOpenChange it would be inert anyway, and an inert close button on the one dialog you must not dismiss is worse than no button. */} ev.preventDefault()} onPointerDownOutside={(ev) => ev.preventDefault()} onInteractOutside={(ev) => ev.preventDefault()} > Write down your recovery phrase These {words.length} words are the only way to recover {walletName} if this server is lost. Officer cannot show them again without your passphrase.
    {words.map((word, i) => (
  1. {i + 1} {word}
  2. ))}

Write them on paper, in order. Anyone who reads them can spend these coins, so do not photograph them, type them into another device, or paste them anywhere.

); };