import { Tabs } from 'antd'; import { useRecoilValue } from 'recoil'; import { FC } from 'react'; import { ErrorBoundary } from 'react-error-boundary'; import { IndieAuthModal } from '../IndieAuthModal/IndieAuthModal'; import { FediAuthModal } from '../FediAuthModal/FediAuthModal'; import styles from './AuthModal.module.scss'; import { currentUserAtom, chatAuthenticatedAtom, accessTokenAtom, clientConfigStateAtom, } from '../../stores/ClientConfigStore'; import { ClientConfig } from '../../../interfaces/client-config.model'; import { ComponentError } from '../../ui/ComponentError/ComponentError'; export type AuthModalProps = { forceTabs?: boolean; }; export const AuthModal: FC = ({ forceTabs }) => { const authenticated = useRecoilValue(chatAuthenticatedAtom); const accessToken = useRecoilValue(accessTokenAtom); const currentUser = useRecoilValue(currentUserAtom); const clientConfig = useRecoilValue(clientConfigStateAtom); if (!currentUser) { return null; } const { displayName } = currentUser; const { federation } = clientConfig; const { enabled: fediverseEnabled } = federation; const indieAuthTabTitle = ( IndieAuth IndieAuth ); const indieAuthTab = ( ); const fediAuthTabTitle = ( Fediverse auth FediAuth ); const fediAuthTab = ( ); const items = [ { label: indieAuthTabTitle, key: '1', children: indieAuthTab }, { label: fediAuthTabTitle, key: '2', children: fediAuthTab }, ]; return ( ( )} >
null} />
); };