mirror of
https://github.com/supabase/supabase.git
synced 2026-10-18 23:59:08 +03:00
* chore: cleanup packages - Avoid circular imports - Export API-types as types - pg-format without depending on Node internal Buffer (not browser-compatible) - Avoid importing from barrel files in ui dir * chore: avoid barrel file imports in studio (#27771) * chore: avoid barrel file imports - Removes some unused imports - Avoids barrel file import for faster builds + less memory * add eslint rule * type fixes * delete layouts barrel * delete components/grid barrel file * delete components/grid/utils barrel file * delete components/grid/components/common barrel file * delete components/grid/components/editor barrel file * delete components/grid/components/formatter barrel file * delete components/grid/components/grid barrel file * delete components/grid/components/header/filter barrel file * remote components/grid/store barrel file * remove components/interfaces/Auth/Policies barrel file * delete components/interfaces/Settings/Logs barrel file * delete components/ui/CodeEditor barrel file * delete components/ui/Forms barrel file * delete components/ui/Shimmers barrel file * delete data/analytics barrel file * delete hooks barrel file * cleanup lib/common/fetch barrel file * final * barral files cleanup * global react-data-grid styles * remove console.log --------- Co-authored-by: Kevin Grüneberg <k.grueneberg1994@gmail.com> * fix build --------- Co-authored-by: Kevin Grüneberg <k.grueneberg1994@gmail.com>
101 lines
3.1 KiB
TypeScript
101 lines
3.1 KiB
TypeScript
import { useRouter } from 'next/router'
|
|
import type { PropsWithChildren } from 'react'
|
|
|
|
import { useParams } from 'common'
|
|
import { useCurrentPath } from 'hooks/misc/useCurrentPath'
|
|
import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
|
|
import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'
|
|
import { useFlag } from 'hooks/ui/useFlag'
|
|
import Link from 'next/link'
|
|
import { NavMenu, NavMenuItem } from 'ui'
|
|
import { useOrgSubscriptionQuery } from '../../data/subscriptions/org-subscription-query'
|
|
import AccountLayout from './AccountLayout/AccountLayout'
|
|
import { ScaffoldContainer, ScaffoldDivider, ScaffoldHeader, ScaffoldTitle } from './Scaffold'
|
|
import SettingsLayout from './SettingsLayout/SettingsLayout'
|
|
|
|
const OrganizationLayout = ({ children }: PropsWithChildren<{}>) => {
|
|
const selectedOrganization = useSelectedOrganization()
|
|
const router = useRouter()
|
|
const currentPath = useCurrentPath()
|
|
const { slug } = useParams()
|
|
|
|
const invoicesEnabledOnProfileLevel = useIsFeatureEnabled('billing:invoices')
|
|
const { data: subscription } = useOrgSubscriptionQuery({ orgSlug: slug })
|
|
const isNotOrgWithPartnerBilling = !(subscription?.billing_via_partner ?? true)
|
|
const invoicesEnabled = invoicesEnabledOnProfileLevel && isNotOrgWithPartnerBilling
|
|
|
|
const navLayoutV2 = useFlag('navigationLayoutV2')
|
|
|
|
if (navLayoutV2) {
|
|
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'}
|
|
breadcrumbs={[{ key: `org-settings`, label: 'Settings' }]}
|
|
>
|
|
<ScaffoldHeader className="pb-0">
|
|
<ScaffoldContainer id="billing-page-top">
|
|
<ScaffoldTitle className="pb-3">
|
|
{selectedOrganization?.name ?? 'Organization'} settings
|
|
</ScaffoldTitle>
|
|
<NavMenu className="border-none" aria-label="Organization menu navigation">
|
|
{filteredNavMenuItems.map((item) => (
|
|
<NavMenuItem key={item.label} active={currentPath === item.href}>
|
|
<Link href={item.href}>{item.label}</Link>
|
|
</NavMenuItem>
|
|
))}
|
|
</NavMenu>
|
|
</ScaffoldContainer>
|
|
</ScaffoldHeader>
|
|
<ScaffoldDivider />
|
|
{children}
|
|
</AccountLayout>
|
|
)
|
|
}
|
|
|
|
export default OrganizationLayout
|