mirror of
https://github.com/supabase/supabase.git
synced 2026-10-07 10:25:06 +03:00
- consolidate `top level menu` and `contextual menu` into nested menu on mobile - remove legacy mobile submenu
41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
import { useFlag, useParams } from 'common'
|
|
import { ProductMenu } from 'components/ui/ProductMenu'
|
|
import { useAuthConfigPrefetch } from 'data/auth/auth-config-query'
|
|
import { withAuth } from 'hooks/misc/withAuth'
|
|
import { useRouter } from 'next/router'
|
|
import type { PropsWithChildren } from 'react'
|
|
|
|
import { ProjectLayout } from '../ProjectLayout'
|
|
import { useGenerateAuthMenu } from './AuthLayout.utils'
|
|
|
|
export const AuthProductMenu = () => {
|
|
const router = useRouter()
|
|
const { ref: projectRef = 'default' } = useParams()
|
|
|
|
useAuthConfigPrefetch({ projectRef })
|
|
const page = router.pathname.split('/')[4]
|
|
const menu = useGenerateAuthMenu()
|
|
|
|
return <ProductMenu page={page} menu={menu} />
|
|
}
|
|
|
|
const AuthLayout = ({ title, children }: PropsWithChildren<{ title: string }>) => {
|
|
return (
|
|
<ProjectLayout
|
|
title={title}
|
|
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)
|