Files
supabase/apps/studio/components/layouts/EdgeFunctionsLayout/EdgeFunctionsLayout.tsx
T
Saxon FletcherandJoshen Lim 27e730380c Improve edge functions layout (#33723)
* page components

* page component changes

* settings but broken saving

* rvert

* use sheet for provider

* styling

* remove things

* Some refactoring and fixing, added JSDocs to layouts

* Smol refactor

* Fix

* Update JSDocs

* updated scaffolding

* update edge functions layout

* remove params

* Clean up

* Spelling

* Clean up FormFieldWrappers

* One last clean up

* fix merge errors

* Address comments

* Remove unnecessary prop

* Remove settings/functions and add redirects in next config

* fix empty

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-02-26 14:17:53 +08:00

52 lines
1.3 KiB
TypeScript

import { useParams } from 'common'
import { ProductMenu } from 'components/ui/ProductMenu'
import { withAuth } from 'hooks/misc/withAuth'
import { useRouter } from 'next/router'
import { PropsWithChildren } from 'react'
import ProjectLayout from '../ProjectLayout/ProjectLayout'
const EdgeFunctionsProductMenu = () => {
const { ref: projectRef = 'default' } = useParams()
const router = useRouter()
const page = router.pathname.split('/')[4]
const menuItems = [
{
name: 'Edge Functions',
key: 'functions',
url: `/project/${projectRef}/functions`,
items: [
{
name: 'Functions',
key: 'main',
url: `/project/${projectRef}/functions`,
items: [],
},
{
name: 'Secrets',
key: 'secrets',
url: `/project/${projectRef}/functions/secrets`,
items: [],
},
],
},
]
return <ProductMenu page={page} menu={menuItems} />
}
const EdgeFunctionsLayout = ({ children }: PropsWithChildren<{}>) => {
return (
<ProjectLayout
title="Edge Functions"
product="Edge Functions"
productMenu={<EdgeFunctionsProductMenu />}
isBlocking={false}
>
{children}
</ProjectLayout>
)
}
export default withAuth(EdgeFunctionsLayout)