Files
supabase/apps/studio/components/layouts/TableEditorLayout/TableEditorLayout.tsx
Joshen Lim 7d70f5a478 Remove observer calls for pages and components that no longer use mobx stores (#21934)
* 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
2024-03-12 15:51:47 +08:00

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