mirror of
https://github.com/supabase/supabase.git
synced 2026-10-07 18:35:07 +03:00
Avoid importing all components via barrel files that lead to bloated bundles/chunks
38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
import { PermissionAction } from '@supabase/shared-types/out/constants'
|
|
import { observer } from 'mobx-react-lite'
|
|
import { PropsWithChildren, useMemo } from 'react'
|
|
|
|
import NoPermission from 'components/ui/NoPermission'
|
|
import { useCheckPermissions, usePermissionsLoaded } from 'hooks'
|
|
import { ProjectLayoutWithAuth } from '../ProjectLayout/ProjectLayout'
|
|
import TableEditorMenu from './TableEditorMenu'
|
|
|
|
const TableEditorLayout = ({ children }: PropsWithChildren<{}>) => {
|
|
const canReadTables = useCheckPermissions(PermissionAction.TENANT_SQL_ADMIN_READ, 'tables')
|
|
const isPermissionsLoaded = usePermissionsLoaded()
|
|
|
|
const tableEditorMenu = useMemo(() => <TableEditorMenu />, [])
|
|
|
|
if (isPermissionsLoaded && !canReadTables) {
|
|
debugger
|
|
return (
|
|
<ProjectLayoutWithAuth isBlocking={false}>
|
|
<NoPermission isFullPage resourceText="view tables from this project" />
|
|
</ProjectLayoutWithAuth>
|
|
)
|
|
}
|
|
|
|
return (
|
|
<ProjectLayoutWithAuth
|
|
product="Table Editor"
|
|
productMenu={tableEditorMenu}
|
|
isBlocking={false}
|
|
resizableSidebar
|
|
>
|
|
{children}
|
|
</ProjectLayoutWithAuth>
|
|
)
|
|
}
|
|
|
|
export default observer(TableEditorLayout)
|