mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 18:05:11 +03:00
* Wrap up remaining swapping of useCheckPermissions * remove OrganizationSettingsLayout on billing, team, integrations and usage org pages * Fix missing loading state in usage page * Add comments for next step
26 lines
837 B
TypeScript
26 lines
837 B
TypeScript
import { PermissionAction } from '@supabase/shared-types/out/constants'
|
|
import { PropsWithChildren } from 'react'
|
|
|
|
import NoPermission from 'components/ui/NoPermission'
|
|
import { useAsyncCheckProjectPermissions } from 'hooks/misc/useCheckPermissions'
|
|
import { ProjectLayoutWithAuth } from '../ProjectLayout/ProjectLayout'
|
|
|
|
const TableEditorLayout = ({ children }: PropsWithChildren<{}>) => {
|
|
const { can: canReadTables, isSuccess: isPermissionsLoaded } = useAsyncCheckProjectPermissions(
|
|
PermissionAction.TENANT_SQL_ADMIN_READ,
|
|
'tables'
|
|
)
|
|
|
|
if (isPermissionsLoaded && !canReadTables) {
|
|
return (
|
|
<ProjectLayoutWithAuth isBlocking={false}>
|
|
<NoPermission isFullPage resourceText="view tables from this project" />
|
|
</ProjectLayoutWithAuth>
|
|
)
|
|
}
|
|
|
|
return children
|
|
}
|
|
|
|
export default TableEditorLayout
|