Skip to content

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

chore: fix compilation error

TzeYiingcb46a12e9067
diff --git a/studio/components/layouts/ReportsLayout/ReportsLayout.tsx b/studio/components/layouts/ReportsLayout/ReportsLayout.tsx
index f1517357776..ef82b75c120 100644
--- a/studio/components/layouts/ReportsLayout/ReportsLayout.tsx
+++ b/studio/components/layouts/ReportsLayout/ReportsLayout.tsx
@@ -5,6 +5,7 @@ import ProductMenu from 'components/ui/ProductMenu'
import { useSelectedProject, withAuth } from 'hooks'
import ProjectLayout from '../'
import { generateReportsMenu } from './ReportsMenu.utils'
+import { useFlag } from 'hooks'
interface ReportsLayoutProps {
title?: string
@@ -15,12 +16,61 @@ const ReportsLayout = ({ title, children }: PropsWithChildren<ReportsLayoutProps
const project = useSelectedProject()
const page = router.pathname.split('/')[4] || ''
+ const ref = project?.ref ?? 'default'
+
+ const storageReportFlag = useFlag('storageReport')
+ const menuItems = [
+ {
+ title: '',
+ items: [
+ {
+ name: 'Custom reports',
+ key: '',
+ url: `/project/${ref}/reports`,
+ items: [],
+ },
+ ],
+ },
+ {
+ items: [
+ {
+ name: 'API',
+ key: 'api-overview',
+ url: `/project/${ref}/reports/api-overview`,
+ items: [],
+ },
+ ...(storageReportFlag
+ ? [
+ {
+ name: 'Storage',
+ key: 'storage',
+ url: `/project/${ref}/reports/storage`,
+ items: [],
+ label: 'NEW',
+ },
+ ]
+ : []),
+ {
+ name: 'Database',
+ key: 'database',
+ url: `/project/${ref}/reports/database`,
+ items: [],
+ },
+ {
+ name: 'Query Performance',
+ key: 'query-performance',
+ url: `/project/${ref}/reports/query-performance`,
+ items: [],
+ },
+ ],
+ },
+ ]
return (
<ProjectLayout
title={title}
product="Reports"
- productMenu={<ProductMenu page={page} menu={generateReportsMenu(project)} />}
+ productMenu={<ProductMenu page={page} menu={menuItems} />}
>
<main style={{ maxHeight: '100vh' }} className="flex-1 overflow-y-auto">
{children}
diff --git a/studio/components/layouts/ReportsLayout/ReportsMenu.utils.ts b/studio/components/layouts/ReportsLayout/ReportsMenu.utils.ts
deleted file mode 100644
index 7fa7ca0238b..00000000000
--- a/studio/components/layouts/ReportsLayout/ReportsMenu.utils.ts
+++ /dev/null
@@ -1,54 +0,0 @@
-import { Project } from 'types'
-import { ProductMenuGroup } from 'components/ui/ProductMenu/ProductMenu.types'
-import { useFlag } from 'hooks'
-
-export const generateReportsMenu = (project?: Project): ProductMenuGroup[] => {
- const ref = project?.ref ?? 'default'
- const storageReportFlag = useFlag('storageReport')
- return [
- {
- title: '',
- items: [
- {
- name: 'Custom reports',
- key: '',
- url: `/project/${ref}/reports`,
- items: [],
- },
- ],
- },
- {
- items: [
- {
- name: 'API',
- key: 'api-overview',
- url: `/project/${ref}/reports/api-overview`,
- items: [],
- },
- ...(storageReportFlag
- ? [
- {
- name: 'Storage',
- key: 'storage',
- url: `/project/${ref}/reports/storage`,
- items: [],
- label: 'NEW',
- },
- ]
- : []),
- {
- name: 'Database',
- key: 'database',
- url: `/project/${ref}/reports/database`,
- items: [],
- },
- {
- name: 'Query Performance',
- key: 'query-performance',
- url: `/project/${ref}/reports/query-performance`,
- items: [],
- },
- ],
- },
- ]
-}