Files
supabase/apps/studio/components/ui/ProductMenu/ProductMenu.tsx
T
Saxon FletcherandJoshen Lim 799c7a4bfd Improve single edge function layout (#33725)
* 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

* single function layout

* invocation cleanup

* remove vars

* Clean up

* Spelling

* Clean up FormFieldWrappers

* One last clean up

* fix merge errors

* fix merge errors

* rmeove import

* Address comments

* Remove unnecessary prop

* Remove settings/functions and add redirects in next config

* fix empty

* Fix key prop issue and fix selected state in layout for single edge function

* Clean up edge function details

* Use zodResolver

* Refactor file name

* Remove unnecessary fragment

* Small refactors

* Refactor deleting edge function to use ConfirmationModal

* edge details fixes

* Small adjustment to paddings

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-03-05 15:39:01 +01:00

59 lines
1.9 KiB
TypeScript

import { Badge, Menu } from 'ui'
import type { ProductMenuGroup } from './ProductMenu.types'
import ProductMenuItem from './ProductMenuItem'
interface ProductMenuProps {
page?: string
menu: ProductMenuGroup[]
}
const ProductMenu = ({ page, menu }: ProductMenuProps) => {
return (
<div className="flex flex-col space-y-8 overflow-y-auto">
<Menu type="pills">
{menu.map((group, idx) => (
<div key={group.key || group.title}>
<div className="my-6 space-y-8">
<div className="mx-3">
<Menu.Group
title={
group.title ? (
<div className="flex flex-col space-y-2 uppercase font-mono">
<span>{group.title}</span>
{group.isPreview && <Badge variant="warning">Not production ready</Badge>}
</div>
) : null
}
/>
<div>
{group.items.map((item) => {
const isActive = !!item.pages ? item.pages.includes(page) : page === item.key
return (
<ProductMenuItem
key={item.key}
url={item.url}
name={item.name}
icon={item.icon}
rightIcon={item.rightIcon}
isActive={isActive}
isExternal={item.isExternal}
target={item.isExternal ? '_blank' : '_self'}
label={item.label}
/>
)
})}
</div>
</div>
</div>
{idx !== menu.length - 1 && <div className="h-px w-full bg-border-overlay" />}
</div>
))}
</Menu>
</div>
)
}
export default ProductMenu