mirror of
https://github.com/supabase/supabase.git
synced 2026-07-02 07:34:43 +08:00
* Final replacements of ui setNotification with toast * Rip out UiStore * Rip out UiStore * Shift files under authConfigSchema to components/Auth * Rip out use of observers * Remove observer calls for pages and components that no longer use mobx stores
37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
import { PermissionAction } from '@supabase/shared-types/out/constants'
|
|
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 TableEditorLayout
|