misc: migrated to switch component

This commit is contained in:
Sheen Capadngan
2024-11-15 23:49:20 +08:00
parent 433971a72d
commit c4b54de303
@@ -4,13 +4,13 @@ import TotpRegistration from "@app/components/mfa/TotpRegistration";
import { createNotification } from "@app/components/notifications"; import { createNotification } from "@app/components/notifications";
import { import {
Button, Button,
Checkbox,
ContentLoader, ContentLoader,
DeleteActionModal, DeleteActionModal,
EmailServiceSetupModal, EmailServiceSetupModal,
FormControl, FormControl,
Select, Select,
SelectItem SelectItem,
Switch
} from "@app/components/v2"; } from "@app/components/v2";
import { useToggle } from "@app/hooks"; import { useToggle } from "@app/hooks";
import { useGetUser, userKeys, useUpdateUserMfa } from "@app/hooks/api"; import { useGetUser, userKeys, useUpdateUserMfa } from "@app/hooks/api";
@@ -140,7 +140,7 @@ export const MFASection = () => {
<div className="mb-6 max-w-6xl rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4"> <div className="mb-6 max-w-6xl rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
<p className="mb-4 text-xl font-semibold text-mineshaft-100">Two-factor Authentication</p> <p className="mb-4 text-xl font-semibold text-mineshaft-100">Two-factor Authentication</p>
{user && ( {user && (
<Checkbox <Switch
className="data-[state=checked]:bg-primary" className="data-[state=checked]:bg-primary"
id="isTwoFAEnabled" id="isTwoFAEnabled"
isChecked={user?.isMfaEnabled} isChecked={user?.isMfaEnabled}
@@ -153,7 +153,7 @@ export const MFASection = () => {
}} }}
> >
Enable 2-factor authentication Enable 2-factor authentication
</Checkbox> </Switch>
)} )}
{user?.isMfaEnabled && ( {user?.isMfaEnabled && (
<FormControl label="Selected 2FA method" className="mt-3"> <FormControl label="Selected 2FA method" className="mt-3">