import { useState } from "react"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { Badge, Button } from "@calcom/ui"; 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); const { t } = useLocale(); return ( <>

{t("2fa")}

{enabled ? t("enabled") : t("disabled")}

{t("add_an_extra_layer_of_security")}

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