Files
supabase/apps/studio/components/layouts/AuthLayout/AuthLayout.tsx
T
Joshen Lim eeaf7e3c38 Minor clean ups (#37653)
* Minor clean ups

* Clean up

* Standardize more icon for table and storage editor

* update copy
2025-08-05 14:26:20 +07:00

40 lines
1.1 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 { 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()
useAuthConfigPrefetch({ projectRef })
const page = router.pathname.split('/')[4]
return <ProductMenu page={page} menu={generateAuthMenu(projectRef)} />
}
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)