AuthEmailsLayout.tsx 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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 AuthEmailsLayout = ({ children }: PropsWithChildren<{}>) => {
  8. const { ref } = useParams()
  9. const showEmails = useIsFeatureEnabled('authentication:emails')
  10. const navItems = [
  11. {
  12. label: 'Templates',
  13. href: `/project/${ref}/auth/templates`,
  14. },
  15. {
  16. label: 'SMTP Settings',
  17. href: `/project/${ref}/auth/smtp`,
  18. },
  19. ]
  20. return (
  21. <AuthLayout title="Emails">
  22. {showEmails ? (
  23. <PageLayout
  24. title="Emails"
  25. subtitle="Configure what emails your users receive and how they are sent"
  26. navigationItems={navItems}
  27. >
  28. {children}
  29. </PageLayout>
  30. ) : (
  31. <UnknownInterface urlBack={`/project/${ref}/auth/users`} />
  32. )}
  33. </AuthLayout>
  34. )
  35. }