Files
supabase/apps/studio/components/layouts/AuthLayout/AuthLayout.tsx
T
Joshen LimandTerry Sutton 39639a4073 chore/disable-more-sections-03 (#38060)
* Add flags for policies, third party auth, and manual linking + providers in sign in page

* Add flag for rate limitm page

* Add UnknownInterface components

* Update comment

* Flip flags to true

* Add flags for realtime policies and reports page

* Temp

* Add flag for sign in providers page

* Add flag for stripe wrapper

* Add flag for custom domains

* Add flag for dedicated ipv4 address addon

* Add empty state for realtime policies

* Add empty state for reports page

* Add flag for disable legacy JWT keys section

* Add flag for legacy jwt keys

* nit

* Remove ConnectionStringMoved call out

* Add flag for project settings log drains

* Add flag for subscription link in project settings

* Deprecate settings/auth page and redirect directly to auth page

* Flip back flags

* Add flags for account preferences analytics marketing and account deleetion

* Remove 'table_editor:enable_rls_toggle' flag and revert UI changes

* Remove 'authentication:policies' flag and revert UI changes

* Update flags

---------

Co-authored-by: Terry Sutton <saltcod@gmail.com>
2025-08-20 21:50:53 +08:00

69 lines
1.9 KiB
TypeScript

import { useRouter } from 'next/router'
import { PropsWithChildren } from 'react'
import { useParams } from 'common'
import { ProductMenu } from 'components/ui/ProductMenu'
import { useAuthConfigPrefetch } from 'data/auth/auth-config-query'
import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
import { withAuth } from 'hooks/misc/withAuth'
import ProjectLayout from '../ProjectLayout/ProjectLayout'
import { generateAuthMenu } from './AuthLayout.utils'
const AuthProductMenu = () => {
const router = useRouter()
const { ref: projectRef = 'default' } = useParams()
const {
authenticationSignInProviders,
authenticationRateLimits,
authenticationEmails,
authenticationMultiFactor,
authenticationAttackProtection,
authenticationAdvanced,
} = useIsFeatureEnabled([
'authentication:sign_in_providers',
'authentication:rate_limits',
'authentication:emails',
'authentication:multi_factor',
'authentication:attack_protection',
'authentication:advanced',
])
useAuthConfigPrefetch({ projectRef })
const page = router.pathname.split('/')[4]
return (
<ProductMenu
page={page}
menu={generateAuthMenu(projectRef, {
authenticationSignInProviders,
authenticationRateLimits,
authenticationEmails,
authenticationMultiFactor,
authenticationAttackProtection,
authenticationAdvanced,
})}
/>
)
}
const AuthLayout = ({ children }: PropsWithChildren<{}>) => {
return (
<ProjectLayout
title="Authentication"
product="Authentication"
productMenu={<AuthProductMenu />}
isBlocking={false}
>
{children}
</ProjectLayout>
)
}
/**
* Layout for all auth pages on the dashboard, wrapped with withAuth to verify logged in state
*
* Handles rendering the navigation for each section under the auth pages.
*/
export default withAuth(AuthLayout)