Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

chore: use new menu component in org tabs (#20549)

Jordi Enrica30d29388132
diff --git a/apps/studio/components/layouts/OrganizationLayout.tsx b/apps/studio/components/layouts/OrganizationLayout.tsx
index 898e3a235c3..58093c0e8af 100644
--- a/apps/studio/components/layouts/OrganizationLayout.tsx
+++ b/apps/studio/components/layouts/OrganizationLayout.tsx
@@ -3,10 +3,11 @@ import { PropsWithChildren } from 'react'
import { useParams } from 'common'
import { useFlag, useIsFeatureEnabled, useSelectedOrganization } from 'hooks'
-import { Tabs } from 'ui'
+import { NavMenu, NavMenuItem } from 'ui'
import { AccountLayout } from './'
import { ScaffoldContainer, ScaffoldDivider, ScaffoldHeader, ScaffoldTitle } from './Scaffold'
import SettingsLayout from './SettingsLayout/SettingsLayout'
+import Link from 'next/link'
const OrganizationLayout = ({ children }: PropsWithChildren<{}>) => {
const selectedOrganization = useSelectedOrganization()
@@ -22,6 +23,48 @@ const OrganizationLayout = ({ children }: PropsWithChildren<{}>) => {
return <SettingsLayout>{children}</SettingsLayout>
}
+ const navMenuItems = [
+ {
+ label: 'General',
+ href: `/org/${slug}/general`,
+ },
+ {
+ label: 'Team',
+ href: `/org/${slug}/team`,
+ },
+ {
+ label: 'Integrations',
+ href: `/org/${slug}/integrations`,
+ },
+ {
+ label: 'Billing',
+ href: `/org/${slug}/billing`,
+ },
+ {
+ label: 'Usage',
+ href: `/org/${slug}/usage`,
+ },
+ {
+ label: 'Invoices',
+ href: `/org/${slug}/invoices`,
+ hidden: !invoicesEnabled,
+ },
+ {
+ label: 'OAuth Apps',
+ href: `/org/${slug}/apps`,
+ },
+ {
+ label: 'Audit Logs',
+ href: `/org/${slug}/audit`,
+ },
+ {
+ label: 'Legal Documents',
+ href: `/org/${slug}/documents`,
+ },
+ ]
+
+ const filteredNavMenuItems = navMenuItems.filter((item) => !item.hidden)
+
return (
<AccountLayout
title={selectedOrganization?.name ?? 'Supabase'}
@@ -32,30 +75,13 @@ const OrganizationLayout = ({ children }: PropsWithChildren<{}>) => {
<ScaffoldTitle>{selectedOrganization?.name ?? 'Organization'} settings</ScaffoldTitle>
</ScaffoldContainer>
<ScaffoldContainer>
- <nav>
- <Tabs
- listClassNames="border-none"
- size="small"
- type="underlined"
- activeId={id}
- onChange={(id: any) => {
- router.push(`/org/${slug}/${id}`)
- }}
- >
- <Tabs.Panel id="general" label="General" className="!my-0" />
- <Tabs.Panel id="team" label="Team" className="!my-0" />
-
- <Tabs.Panel id="integrations" label="Integrations" className="!my-0" />
-
- <Tabs.Panel id="billing" label="Billing" className="!my-0" />
- <Tabs.Panel id="usage" label="Usage" className="!my-0" />
- {invoicesEnabled && <Tabs.Panel id="invoices" label="Invoices" className="!my-0" />}
- <Tabs.Panel id="apps" label="OAuth Apps" className="!my-0" />
- <Tabs.Panel id="audit" label="Audit Logs" className="!my-0" />
-
- <Tabs.Panel id="documents" label="Legal Documents" className="!my-0" />
- </Tabs>
- </nav>
+ <NavMenu className="border-none" aria-label="Organization menu navigation">
+ {filteredNavMenuItems.map((item) => (
+ <NavMenuItem key={item.label} active={item.href === router.asPath}>
+ <Link href={item.href}>{item.label}</Link>
+ </NavMenuItem>
+ ))}
+ </NavMenu>
</ScaffoldContainer>
</ScaffoldHeader>
<ScaffoldDivider />