mirror of
https://github.com/supabase/supabase.git
synced 2026-07-02 16:44:20 +08:00
* init * update import names * Update resizable.tsx * resizable bg now goes lighter on drag * only resizable for table editor and sql editor * Update ProjectLayout.tsx * Update index.tsx * Remove unneeded console.log. --------- Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
38 lines
1.1 KiB
TypeScript
38 lines
1.1 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 '../'
|
|
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)
|