mirror of
https://github.com/supabase/supabase.git
synced 2026-10-07 02:15:05 +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>
75 lines
2.6 KiB
TypeScript
75 lines
2.6 KiB
TypeScript
import { useRouter } from 'next/router'
|
|
import { PropsWithChildren } from 'react'
|
|
|
|
import { useIsColumnLevelPrivilegesEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext'
|
|
import { ProductMenu } from 'components/ui/ProductMenu'
|
|
import { useDatabaseExtensionsQuery } from 'data/database-extensions/database-extensions-query'
|
|
import { useProjectAddonsQuery } from 'data/subscriptions/project-addons-query'
|
|
import { useSelectedProject } from 'hooks/misc/useSelectedProject'
|
|
import { withAuth } from 'hooks/misc/withAuth'
|
|
import Link from 'next/link'
|
|
import { AlertDescription_Shadcn_, AlertTitle_Shadcn_, Alert_Shadcn_ } from 'ui'
|
|
import ProjectLayout from '../ProjectLayout/ProjectLayout'
|
|
import { generateDatabaseMenu } from './DatabaseMenu.utils'
|
|
|
|
export interface DatabaseLayoutProps {
|
|
title?: string
|
|
}
|
|
|
|
const DatabaseProductMenu = () => {
|
|
const project = useSelectedProject()
|
|
|
|
const router = useRouter()
|
|
const page = router.pathname.split('/')[4]
|
|
|
|
const { data } = useDatabaseExtensionsQuery({
|
|
projectRef: project?.ref,
|
|
connectionString: project?.connectionString,
|
|
})
|
|
const { data: addons } = useProjectAddonsQuery({ projectRef: project?.ref })
|
|
|
|
const pgNetExtensionExists = (data ?? []).find((ext) => ext.name === 'pg_net') !== undefined
|
|
const pitrEnabled = addons?.selected_addons.find((addon) => addon.type === 'pitr') !== undefined
|
|
const columnLevelPrivileges = useIsColumnLevelPrivilegesEnabled()
|
|
|
|
return (
|
|
<>
|
|
<ProductMenu
|
|
page={page}
|
|
menu={generateDatabaseMenu(project, {
|
|
pgNetExtensionExists,
|
|
pitrEnabled,
|
|
columnLevelPrivileges,
|
|
})}
|
|
/>
|
|
<div className="px-3">
|
|
<Alert_Shadcn_>
|
|
<AlertTitle_Shadcn_ className="text-sm">
|
|
Replication section has been renamed
|
|
</AlertTitle_Shadcn_>
|
|
<AlertDescription_Shadcn_ className="text-xs">
|
|
<p className="mb-2">
|
|
It can be now found under{' '}
|
|
<Link href={`/project/${project?.ref}/database/publications`} className="underline">
|
|
Publications
|
|
</Link>
|
|
</p>
|
|
</AlertDescription_Shadcn_>
|
|
</Alert_Shadcn_>
|
|
</div>
|
|
</>
|
|
)
|
|
}
|
|
|
|
const DatabaseLayout = ({ children }: PropsWithChildren<DatabaseLayoutProps>) => {
|
|
return (
|
|
<ProjectLayout product="Database" productMenu={<DatabaseProductMenu />} isBlocking={false}>
|
|
<main style={{ maxHeight: '100vh' }} className="flex-1 overflow-y-auto">
|
|
{children}
|
|
</main>
|
|
</ProjectLayout>
|
|
)
|
|
}
|
|
|
|
export default withAuth(DatabaseLayout)
|