import { FC } from 'react' import { observer } from 'mobx-react-lite' import { PostgresTable } from '@supabase/postgres-meta' import { PermissionAction } from '@supabase/shared-types/out/constants' import { checkPermissions, useStore } from 'hooks' import ProductEmptyState from 'components/to-be-cleaned/ProductEmptyState' interface Props { selectedSchema: string onAddTable: () => void } const EmptyState: FC = ({ selectedSchema, onAddTable }) => { const { meta } = useStore() const tables = meta.tables.list((table: PostgresTable) => table.schema === selectedSchema) const isProtectedSchema = meta.excludedSchemas.includes(selectedSchema) const canCreateTables = !isProtectedSchema && checkPermissions(PermissionAction.TENANT_SQL_ADMIN_WRITE, 'tables') return (
{tables.length === 0 ? (

There are no tables available in this schema.

) : (

Select a table from the navigation panel on the left to view its data {canCreateTables && ', or create a new one.'}

)}
) } export default observer(EmptyState)