AuthProvidersLayout.tsx 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { useParams } from 'common'
  2. import { PropsWithChildren } from 'react'
  3. import AuthLayout from './AuthLayout'
  4. import { PageLayout } from '@/components/layouts/PageLayout/PageLayout'
  5. import { UnknownInterface } from '@/components/ui/UnknownInterface'
  6. import { useIsFeatureEnabled } from '@/hooks/misc/useIsFeatureEnabled'
  7. export const AuthProvidersLayout = ({ children }: PropsWithChildren<{}>) => {
  8. const { ref } = useParams()
  9. const { authenticationSignInProviders, authenticationThirdPartyAuth } = useIsFeatureEnabled([
  10. 'authentication:sign_in_providers',
  11. 'authentication:third_party_auth',
  12. ])
  13. const navItems = [
  14. {
  15. label: 'Briven Auth',
  16. href: `/project/${ref}/auth/providers`,
  17. },
  18. ...(authenticationThirdPartyAuth
  19. ? [
  20. {
  21. label: 'Third-Party Auth',
  22. href: `/project/${ref}/auth/third-party`,
  23. },
  24. ]
  25. : []),
  26. ]
  27. return (
  28. <AuthLayout title="Sign In / Providers">
  29. {authenticationSignInProviders ? (
  30. <PageLayout
  31. title="Sign In / Providers"
  32. subtitle="Configure authentication providers and login methods for your users"
  33. navigationItems={navItems}
  34. >
  35. {children}
  36. </PageLayout>
  37. ) : (
  38. <UnknownInterface urlBack={`/project/${ref}/auth/users`} />
  39. )}
  40. </AuthLayout>
  41. )
  42. }