mirror of
https://github.com/supabase/supabase.git
synced 2026-10-08 02:45:07 +03:00
* feat: basic auth overview page setup Adds the route and layout for the Authentication Overview page. * feat: add feature flag for auth overview * chore: small clean up * feat: add overview page header * feat: create sections for auth overview page Adds three high level components for the sections of the Auth overview page. Can break down further later * feat: add conditional redirect for top level sidebar item This adds a redirect based on whether overview page is enabled or not. For users who dont have it enabled they go to users as default when tapping authentication. * feat: add redirect if overview is set to false * fix: add loaded context for feature flag * chore: clean up scaffolding mark up * chore: remove unused important * chore: placeholders for sections
73 lines
2.0 KiB
TypeScript
73 lines
2.0 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'
|
|
import { useFlag } from 'common'
|
|
|
|
const AuthProductMenu = () => {
|
|
const router = useRouter()
|
|
const { ref: projectRef = 'default' } = useParams()
|
|
|
|
const authenticationShowOverview = useFlag('authOverviewPage')
|
|
|
|
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,
|
|
authenticationShowOverview,
|
|
})}
|
|
/>
|
|
)
|
|
}
|
|
|
|
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)
|