providers.tsx32 lines · main
| 1 | import { useFlag } from 'common' |
| 2 | import { PageContainer } from 'ui-patterns/PageContainer' |
| 3 | |
| 4 | import { AuthProvidersForm } from '@/components/interfaces/Auth/AuthProvidersForm' |
| 5 | import { BasicAuthSettingsForm } from '@/components/interfaces/Auth/BasicAuthSettingsForm' |
| 6 | import { CustomAuthProviders } from '@/components/interfaces/Auth/CustomAuthProviders' |
| 7 | import { AuthProvidersLayout } from '@/components/layouts/AuthLayout/AuthProvidersLayout' |
| 8 | import DefaultLayout from '@/components/layouts/DefaultLayout' |
| 9 | import { useIsFeatureEnabled } from '@/hooks/misc/useIsFeatureEnabled' |
| 10 | import type { NextPageWithLayout } from '@/types' |
| 11 | |
| 12 | const ProvidersPage: NextPageWithLayout = () => { |
| 13 | const showProviders = useIsFeatureEnabled('authentication:show_providers') |
| 14 | const showCustomProviders = useIsFeatureEnabled('authentication:show_custom_providers') |
| 15 | const isOauthProvidersEnabled = useFlag('CustomOauthProviders') |
| 16 | |
| 17 | return ( |
| 18 | <PageContainer size="default"> |
| 19 | <BasicAuthSettingsForm /> |
| 20 | {showProviders && <AuthProvidersForm />} |
| 21 | {showCustomProviders && isOauthProvidersEnabled && <CustomAuthProviders />} |
| 22 | </PageContainer> |
| 23 | ) |
| 24 | } |
| 25 | |
| 26 | ProvidersPage.getLayout = (page) => ( |
| 27 | <DefaultLayout> |
| 28 | <AuthProvidersLayout>{page}</AuthProvidersLayout> |
| 29 | </DefaultLayout> |
| 30 | ) |
| 31 | |
| 32 | export default ProvidersPage |