import showToast from "@/utils/toast"; import { DownloadSimple, Key } from "@phosphor-icons/react"; import { saveAs } from "file-saver"; import { useState } from "react"; import ModalWrapper from "@/components/ModalWrapper"; export default function RecoveryCodeModal({ recoveryCodes, onDownloadComplete, onClose, }) { const [downloadClicked, setDownloadClicked] = useState(false); const downloadRecoveryCodes = () => { const blob = new Blob([recoveryCodes.join("\n")], { type: "text/plain" }); saveAs(blob, "recovery_codes.txt"); setDownloadClicked(true); }; const handleClose = () => { if (downloadClicked) { onDownloadComplete(); onClose(); } }; const handleCopyToClipboard = () => { navigator.clipboard.writeText(recoveryCodes.join(",\n")).then(() => { showToast("Recovery codes copied to clipboard", "success", { clear: true, }); }); }; return (

Recovery Codes

In order to reset your password in the future, you will need these recovery codes. Download or copy your recovery codes to save them.{" "}
These recovery codes are only shown once!

    {recoveryCodes.map((code, index) => (
  • {code}
  • ))}
); }