import { useState } from "react"; import Badge from "@components/ui/Badge"; import Button from "@components/ui/Button"; import DisableTwoFactorModal from "./DisableTwoFactorModal"; import EnableTwoFactorModal from "./EnableTwoFactorModal"; const TwoFactorAuthSection = ({ twoFactorEnabled }: { twoFactorEnabled: boolean }) => { const [enabled, setEnabled] = useState(twoFactorEnabled); const [enableModalOpen, setEnableModalOpen] = useState(false); const [disableModalOpen, setDisableModalOpen] = useState(false); return ( <>

Two-Factor Authentication

{enabled ? "Enabled" : "Disabled"}

Add an extra layer of security to your account in case your password is stolen.

{enableModalOpen && ( { setEnabled(true); setEnableModalOpen(false); }} onCancel={() => setEnableModalOpen(false)} /> )} {disableModalOpen && ( { setEnabled(false); setDisableModalOpen(false); }} onCancel={() => setDisableModalOpen(false)} /> )} ); }; export default TwoFactorAuthSection;