mirror of
https://github.com/documenso/documenso.git
synced 2025-11-21 20:21:38 +10:00
## Description Add the ability to feature flag the teams feature via UI. Also added minor UI changes ## Checklist - [X] I have tested these changes locally and they work as expected. - [X] I have added/updated tests that prove the effectiveness of these changes. - [X] I have followed the project's coding style guidelines.
44 lines
1.2 KiB
TypeScript
44 lines
1.2 KiB
TypeScript
'use client';
|
|
|
|
import { useState } from 'react';
|
|
|
|
import { Button } from '@documenso/ui/primitives/button';
|
|
|
|
import { DisableAuthenticatorAppDialog } from './disable-authenticator-app-dialog';
|
|
import { EnableAuthenticatorAppDialog } from './enable-authenticator-app-dialog';
|
|
|
|
type AuthenticatorAppProps = {
|
|
isTwoFactorEnabled: boolean;
|
|
};
|
|
|
|
export const AuthenticatorApp = ({ isTwoFactorEnabled }: AuthenticatorAppProps) => {
|
|
const [modalState, setModalState] = useState<'enable' | 'disable' | null>(null);
|
|
|
|
const isEnableDialogOpen = modalState === 'enable';
|
|
const isDisableDialogOpen = modalState === 'disable';
|
|
|
|
return (
|
|
<>
|
|
<div className="flex-shrink-0">
|
|
{isTwoFactorEnabled ? (
|
|
<Button variant="destructive" onClick={() => setModalState('disable')}>
|
|
Disable 2FA
|
|
</Button>
|
|
) : (
|
|
<Button onClick={() => setModalState('enable')}>Enable 2FA</Button>
|
|
)}
|
|
</div>
|
|
|
|
<EnableAuthenticatorAppDialog
|
|
open={isEnableDialogOpen}
|
|
onOpenChange={(open) => !open && setModalState(null)}
|
|
/>
|
|
|
|
<DisableAuthenticatorAppDialog
|
|
open={isDisableDialogOpen}
|
|
onOpenChange={(open) => !open && setModalState(null)}
|
|
/>
|
|
</>
|
|
);
|
|
};
|