mirror of
https://github.com/supabase/supabase.git
synced 2026-05-09 10:19:50 -04:00
4a0bb36ca8
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
61 lines
1.5 KiB
TypeScript
61 lines
1.5 KiB
TypeScript
import { useParams } from 'common'
|
|
import { useRouter } from 'next/router'
|
|
import type { ComponentProps, PropsWithChildren } from 'react'
|
|
|
|
import { ProjectLayout } from '../ProjectLayout'
|
|
import { ProductMenu } from '@/components/ui/ProductMenu'
|
|
import { withAuth } from '@/hooks/misc/withAuth'
|
|
|
|
export const EdgeFunctionsProductMenu = () => {
|
|
const { ref: projectRef = 'default' } = useParams()
|
|
const router = useRouter()
|
|
const page = router.pathname.split('/')[4]
|
|
|
|
const menuItems = [
|
|
{
|
|
title: 'Manage',
|
|
items: [
|
|
{
|
|
name: 'Functions',
|
|
key: 'main',
|
|
pages: ['', '[functionSlug]', 'new'],
|
|
url: `/project/${projectRef}/functions`,
|
|
items: [],
|
|
},
|
|
{
|
|
name: 'Secrets',
|
|
key: 'secrets',
|
|
url: `/project/${projectRef}/functions/secrets`,
|
|
items: [],
|
|
},
|
|
],
|
|
},
|
|
]
|
|
|
|
return <ProductMenu page={page} menu={menuItems} />
|
|
}
|
|
|
|
interface EdgeFunctionsLayoutProps {
|
|
title: string
|
|
browserTitle?: ComponentProps<typeof ProjectLayout>['browserTitle']
|
|
}
|
|
|
|
const EdgeFunctionsLayout = ({
|
|
children,
|
|
title,
|
|
browserTitle,
|
|
}: PropsWithChildren<EdgeFunctionsLayoutProps>) => {
|
|
return (
|
|
<ProjectLayout
|
|
product="Edge Functions"
|
|
browserTitle={{ ...browserTitle, section: title }}
|
|
productMenu={<EdgeFunctionsProductMenu />}
|
|
isBlocking={false}
|
|
>
|
|
{children}
|
|
</ProjectLayout>
|
|
)
|
|
}
|
|
|
|
export default withAuth(EdgeFunctionsLayout)
|