Skip to content

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

Update org settings pages to use OrgLayout

Joshen Lim834cfd43024c
diff --git a/studio/components/layouts/OrganizationLayout.tsx b/studio/components/layouts/OrganizationLayout.tsx
new file mode 100644
index 00000000000..0b323386d03
--- /dev/null
+++ b/studio/components/layouts/OrganizationLayout.tsx
@@ -0,0 +1,23 @@
+import { useStore } from 'hooks'
+import { observer } from 'mobx-react-lite'
+import { FC, ReactNode } from 'react'
+import { AccountLayout } from './'
+
+interface Props {
+ children: ReactNode
+}
+
+const OrganizationLayout: FC<Props> = ({ children }) => {
+ const { ui } = useStore()
+
+ return (
+ <AccountLayout
+ title={ui.selectedOrganization?.name ?? 'Supabase'}
+ breadcrumbs={[{ key: `org-settings`, label: 'Settings' }]}
+ >
+ {children}
+ </AccountLayout>
+ )
+}
+
+export default observer(OrganizationLayout)
diff --git a/studio/components/layouts/index.ts b/studio/components/layouts/index.ts
index d0a687bffbf..622cae0180b 100644
--- a/studio/components/layouts/index.ts
+++ b/studio/components/layouts/index.ts
@@ -15,6 +15,7 @@ import { WizardLayoutWithoutAuth } from './WizardLayout'
import VercelIntegrationLayout from './VercelIntegrationLayout'
import BillingLayout from './BillingLayout'
import LogsLayout from './LogsLayout/LogsLayout'
+import OrganizationLayout from './OrganizationLayout'
export {
ProjectLayoutWithAuth,
@@ -34,6 +35,7 @@ export {
VercelIntegrationLayout,
BillingLayout,
LogsLayout,
+ OrganizationLayout,
}
export default ProjectLayout
diff --git a/studio/pages/org/[slug]/billing.tsx b/studio/pages/org/[slug]/billing.tsx
index 81a4bd3e393..b8510f913f3 100644
--- a/studio/pages/org/[slug]/billing.tsx
+++ b/studio/pages/org/[slug]/billing.tsx
@@ -1,28 +1,20 @@
import { useRouter } from 'next/router'
import { observer } from 'mobx-react-lite'
-import { NextPage } from 'next'
import { Tabs } from 'ui'
+import { NextPageWithLayout } from 'types'
import { useParams, useStore } from 'hooks'
import Loading from 'components/ui/Loading'
-import { AccountLayout } from 'components/layouts'
+import { OrganizationLayout } from 'components/layouts'
import { BillingSettings } from 'components/interfaces/Organization'
-const OrgBillingSettings: NextPage = () => {
+const OrgBillingSettings: NextPageWithLayout = () => {
const { ui } = useStore()
const { slug } = useParams()
const router = useRouter()
return (
- <AccountLayout
- title={ui.selectedOrganization?.name ?? 'Supabase'}
- breadcrumbs={[
- {
- key: `org-settings`,
- label: 'Settings',
- },
- ]}
- >
+ <>
{ui.selectedOrganization === undefined && (ui?.permissions ?? []).length === 0 ? (
<Loading />
) : (
@@ -55,8 +47,9 @@ const OrgBillingSettings: NextPage = () => {
</div>
</div>
)}
- </AccountLayout>
+ </>
)
}
+OrgBillingSettings.getLayout = (page) => <OrganizationLayout>{page}</OrganizationLayout>
export default observer(OrgBillingSettings)
diff --git a/studio/pages/org/[slug]/general.tsx b/studio/pages/org/[slug]/general.tsx
index c707a5f88d0..43cd730e8a2 100644
--- a/studio/pages/org/[slug]/general.tsx
+++ b/studio/pages/org/[slug]/general.tsx
@@ -1,28 +1,20 @@
import { useRouter } from 'next/router'
import { observer } from 'mobx-react-lite'
-import { NextPage } from 'next'
import { Tabs } from 'ui'
+import { NextPageWithLayout } from 'types'
import { useParams, useStore } from 'hooks'
import Loading from 'components/ui/Loading'
-import { AccountLayout } from 'components/layouts'
+import { OrganizationLayout } from 'components/layouts'
import { GeneralSettings } from 'components/interfaces/Organization'
-const OrgGeneralSettings: NextPage = () => {
+const OrgGeneralSettings: NextPageWithLayout = () => {
const { ui } = useStore()
const { slug } = useParams()
const router = useRouter()
return (
- <AccountLayout
- title={ui.selectedOrganization?.name ?? 'Supabase'}
- breadcrumbs={[
- {
- key: `org-settings`,
- label: 'Settings',
- },
- ]}
- >
+ <>
{ui.selectedOrganization === undefined && (ui?.permissions ?? []).length === 0 ? (
<Loading />
) : (
@@ -55,8 +47,9 @@ const OrgGeneralSettings: NextPage = () => {
</div>
</div>
)}
- </AccountLayout>
+ </>
)
}
+OrgGeneralSettings.getLayout = (page) => <OrganizationLayout>{page}</OrganizationLayout>
export default observer(OrgGeneralSettings)
diff --git a/studio/pages/org/[slug]/invoices.tsx b/studio/pages/org/[slug]/invoices.tsx
index 3615a7e0f43..f6ee9ee7eae 100644
--- a/studio/pages/org/[slug]/invoices.tsx
+++ b/studio/pages/org/[slug]/invoices.tsx
@@ -1,28 +1,20 @@
import { useRouter } from 'next/router'
import { observer } from 'mobx-react-lite'
-import { NextPage } from 'next'
import { Tabs } from 'ui'
+import { NextPageWithLayout } from 'types'
import { useParams, useStore } from 'hooks'
import Loading from 'components/ui/Loading'
-import { AccountLayout } from 'components/layouts'
+import { OrganizationLayout } from 'components/layouts'
import { InvoicesSettings } from 'components/interfaces/Organization'
-const OrgInvoices: NextPage = () => {
+const OrgInvoices: NextPageWithLayout = () => {
const { ui } = useStore()
const { slug } = useParams()
const router = useRouter()
return (
- <AccountLayout
- title={ui.selectedOrganization?.name ?? 'Supabase'}
- breadcrumbs={[
- {
- key: `org-settings`,
- label: 'Settings',
- },
- ]}
- >
+ <>
{ui.selectedOrganization === undefined && (ui?.permissions ?? []).length === 0 ? (
<Loading />
) : (
@@ -55,8 +47,9 @@ const OrgInvoices: NextPage = () => {
</div>
</div>
)}
- </AccountLayout>
+ </>
)
}
+OrgInvoices.getLayout = (page) => <OrganizationLayout>{page}</OrganizationLayout>
export default observer(OrgInvoices)
diff --git a/studio/pages/org/[slug]/team.tsx b/studio/pages/org/[slug]/team.tsx
index 20ca909c741..f90d16a6486 100644
--- a/studio/pages/org/[slug]/team.tsx
+++ b/studio/pages/org/[slug]/team.tsx
@@ -1,28 +1,20 @@
import { useRouter } from 'next/router'
import { observer } from 'mobx-react-lite'
-import { NextPage } from 'next'
import { Tabs } from 'ui'
+import { NextPageWithLayout } from 'types'
import { useParams, useStore } from 'hooks'
import Loading from 'components/ui/Loading'
-import { AccountLayout } from 'components/layouts'
+import { OrganizationLayout } from 'components/layouts'
import { TeamSettings } from 'components/interfaces/Organization'
-const OrgTeamSettings: NextPage = () => {
+const OrgTeamSettings: NextPageWithLayout = () => {
const { ui } = useStore()
const { slug } = useParams()
const router = useRouter()
return (
- <AccountLayout
- title={ui.selectedOrganization?.name ?? 'Supabase'}
- breadcrumbs={[
- {
- key: `org-settings`,
- label: 'Settings',
- },
- ]}
- >
+ <>
{ui.selectedOrganization === undefined && (ui?.permissions ?? []).length === 0 ? (
<Loading />
) : (
@@ -55,8 +47,9 @@ const OrgTeamSettings: NextPage = () => {
</div>
</div>
)}
- </AccountLayout>
+ </>
)
}
+OrgTeamSettings.getLayout = (page) => <OrganizationLayout>{page}</OrganizationLayout>
export default observer(OrgTeamSettings)