AuthEmailsLayout.tsx40 lines · main
| 1 | import { useParams } from 'common' |
| 2 | import { PropsWithChildren } from 'react' |
| 3 | |
| 4 | import AuthLayout from './AuthLayout' |
| 5 | import { PageLayout } from '@/components/layouts/PageLayout/PageLayout' |
| 6 | import { UnknownInterface } from '@/components/ui/UnknownInterface' |
| 7 | import { useIsFeatureEnabled } from '@/hooks/misc/useIsFeatureEnabled' |
| 8 | |
| 9 | export const AuthEmailsLayout = ({ children }: PropsWithChildren<{}>) => { |
| 10 | const { ref } = useParams() |
| 11 | |
| 12 | const showEmails = useIsFeatureEnabled('authentication:emails') |
| 13 | |
| 14 | const navItems = [ |
| 15 | { |
| 16 | label: 'Templates', |
| 17 | href: `/project/${ref}/auth/templates`, |
| 18 | }, |
| 19 | { |
| 20 | label: 'SMTP Settings', |
| 21 | href: `/project/${ref}/auth/smtp`, |
| 22 | }, |
| 23 | ] |
| 24 | |
| 25 | return ( |
| 26 | <AuthLayout title="Emails"> |
| 27 | {showEmails ? ( |
| 28 | <PageLayout |
| 29 | title="Emails" |
| 30 | subtitle="Configure what emails your users receive and how they are sent" |
| 31 | navigationItems={navItems} |
| 32 | > |
| 33 | {children} |
| 34 | </PageLayout> |
| 35 | ) : ( |
| 36 | <UnknownInterface urlBack={`/project/${ref}/auth/users`} /> |
| 37 | )} |
| 38 | </AuthLayout> |
| 39 | ) |
| 40 | } |