
* feat: add crowdin and supported languages * fix: main branch name * feat: test crowdin integration * feat: add crowdin config skeleton * feat: update crowdin.yml * fix: remove ro translation * test: en translation * test: en translation * New Crowdin translations by Github Action (#735) Co-authored-by: Crowdin Bot <support+bot@crowdin.com> * test: en translation * fix: separate upload/download workflows * wip * New Crowdin translations by Github Action (#738) Co-authored-by: Crowdin Bot <support+bot@crowdin.com> * wip * wip * wip * wip * wip * typo * wip * wip * update crowdin config * update * chore: support i18n de,es,fr,it,pt,ru,ro,en * chore: extract i18n strings * chore: extract booking components strings for i18n * wip * extract more strings * wip * fallback to getServerSideProps for now * New Crowdin translations by Github Action (#874) Co-authored-by: Crowdin Bot <support+bot@crowdin.com> * fix: minor fixes on the datepicker * fix: add dutch lang * fix: linting issues * fix: string * fix: update GHA * cleanup trpc * fix linting Co-authored-by: Peer Richelsen <peeroke@gmail.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Crowdin Bot <support+bot@crowdin.com> Co-authored-by: Bailey Pumfleet <pumfleet@hey.com>
65 lines
1.9 KiB
TypeScript
65 lines
1.9 KiB
TypeScript
import { useState } from "react";
|
|
|
|
import { useLocale } from "@lib/hooks/useLocale";
|
|
|
|
import Badge from "@components/ui/Badge";
|
|
import Button from "@components/ui/Button";
|
|
|
|
import DisableTwoFactorModal from "./DisableTwoFactorModal";
|
|
import EnableTwoFactorModal from "./EnableTwoFactorModal";
|
|
|
|
const TwoFactorAuthSection = ({
|
|
twoFactorEnabled,
|
|
localeProp,
|
|
}: {
|
|
twoFactorEnabled: boolean;
|
|
localeProp: string;
|
|
}) => {
|
|
const [enabled, setEnabled] = useState(twoFactorEnabled);
|
|
const [enableModalOpen, setEnableModalOpen] = useState(false);
|
|
const [disableModalOpen, setDisableModalOpen] = useState(false);
|
|
const { t, locale } = useLocale({ localeProp });
|
|
|
|
return (
|
|
<>
|
|
<div className="flex flex-row items-center">
|
|
<h2 className="font-cal text-lg leading-6 font-medium text-gray-900">{t("2fa")}</h2>
|
|
<Badge className="text-xs ml-2" variant={enabled ? "success" : "gray"}>
|
|
{enabled ? "Enabled" : "Disabled"}
|
|
</Badge>
|
|
</div>
|
|
<p className="mt-1 text-sm text-gray-500">{t("add_an_extra_layer_of_security")}</p>
|
|
|
|
<Button
|
|
className="mt-6"
|
|
type="submit"
|
|
onClick={() => (enabled ? setDisableModalOpen(true) : setEnableModalOpen(true))}>
|
|
{enabled ? "Disable" : "Enable"} {t("2fa")}
|
|
</Button>
|
|
|
|
{enableModalOpen && (
|
|
<EnableTwoFactorModal
|
|
localeProp={locale}
|
|
onEnable={() => {
|
|
setEnabled(true);
|
|
setEnableModalOpen(false);
|
|
}}
|
|
onCancel={() => setEnableModalOpen(false)}
|
|
/>
|
|
)}
|
|
|
|
{disableModalOpen && (
|
|
<DisableTwoFactorModal
|
|
localeProp={locale}
|
|
onDisable={() => {
|
|
setEnabled(false);
|
|
setDisableModalOpen(false);
|
|
}}
|
|
onCancel={() => setDisableModalOpen(false)}
|
|
/>
|
|
)}
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default TwoFactorAuthSection;
|