The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Add product empty state to schema visualizer (#33471)
Joshen Lim0a569b8aa72f
diff --git a/apps/studio/components/interfaces/Database/Schemas/SchemaGraph.tsx b/apps/studio/components/interfaces/Database/Schemas/SchemaGraph.tsxindex 706c526cfd5..7bd792f6b5e 100644--- a/apps/studio/components/interfaces/Database/Schemas/SchemaGraph.tsx+++ b/apps/studio/components/interfaces/Database/Schemas/SchemaGraph.tsx@@ -7,6 +7,7 @@ import 'reactflow/dist/style.css'import { useParams } from 'common'import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'+import ProductEmptyState from 'components/to-be-cleaned/ProductEmptyState'import AlertError from 'components/ui/AlertError'import { ButtonTooltip } from 'components/ui/ButtonTooltip'import SchemaSelector from 'components/ui/SchemaSelector'@@ -147,42 +148,58 @@ export const SchemaGraph = () => {</div>)}{isSuccessTables && (- <div className="w-full h-full">- <ReactFlow- defaultNodes={[]}- defaultEdges={[]}- defaultEdgeOptions={{- type: 'smoothstep',- animated: true,- deletable: false,- style: {- stroke: 'hsl(var(--border-stronger))',- strokeWidth: 0.5,- },- }}- nodeTypes={nodeTypes}- fitView- minZoom={0.8}- maxZoom={1.8}- proOptions={{ hideAttribution: true }}- onNodeDragStop={() => saveNodePositions()}- >- <Background- gap={16}- className="[&>*]:stroke-foreground-muted opacity-[25%]"- variant={BackgroundVariant.Dots}- color={'inherit'}- />- <MiniMap- pannable- zoomable- nodeColor={miniMapNodeColor}- maskColor={miniMapMaskColor}- className="border rounded-md shadow-sm"- />- <SchemaGraphLegend />- </ReactFlow>- </div>+ <>+ {tables.length === 0 ? (+ <div className="h-full flex items-center justify-center">+ <ProductEmptyState+ title="No tables created yet"+ ctaButtonLabel="Create a new table"+ ctaUrl={`/project/${ref}/editor?create=table`}+ >+ <p className="text-sm text-foreground-light">+ There are no tables found in the schema "{selectedSchema}"+ </p>+ </ProductEmptyState>+ </div>+ ) : (+ <div className="w-full h-full">+ <ReactFlow+ defaultNodes={[]}+ defaultEdges={[]}+ defaultEdgeOptions={{+ type: 'smoothstep',+ animated: true,+ deletable: false,+ style: {+ stroke: 'hsl(var(--border-stronger))',+ strokeWidth: 0.5,+ },+ }}+ nodeTypes={nodeTypes}+ fitView+ minZoom={0.8}+ maxZoom={1.8}+ proOptions={{ hideAttribution: true }}+ onNodeDragStop={() => saveNodePositions()}+ >+ <Background+ gap={16}+ className="[&>*]:stroke-foreground-muted opacity-[25%]"+ variant={BackgroundVariant.Dots}+ color={'inherit'}+ />+ <MiniMap+ pannable+ zoomable+ nodeColor={miniMapNodeColor}+ maskColor={miniMapMaskColor}+ className="border rounded-md shadow-sm"+ />+ <SchemaGraphLegend />+ </ReactFlow>+ </div>+ )}+ </>)}</>)diff --git a/apps/studio/components/to-be-cleaned/ProductEmptyState.tsx b/apps/studio/components/to-be-cleaned/ProductEmptyState.tsxindex 7255dde4c4c..2b7d675a58a 100644--- a/apps/studio/components/to-be-cleaned/ProductEmptyState.tsx+++ b/apps/studio/components/to-be-cleaned/ProductEmptyState.tsx@@ -2,6 +2,7 @@ import { ExternalLink } from 'lucide-react'import { PropsWithChildren } from 'react'import { ButtonTooltip } from 'components/ui/ButtonTooltip'+import Link from 'next/link'import { Button } from 'ui'interface ProductEmptyStateProps {@@ -14,6 +15,7 @@ interface ProductEmptyStateProps {loading?: booleandisabled?: booleandisabledMessage?: string+ ctaUrl?: string}const ProductEmptyState = ({@@ -27,6 +29,7 @@ const ProductEmptyState = ({loading = false,disabled = false,disabledMessage = '',+ ctaUrl,}: PropsWithChildren<ProductEmptyStateProps>) => {const hasAction = (ctaButtonLabel && onClickCta) || (infoButtonUrl && infoButtonLabel)@@ -40,7 +43,11 @@ const ProductEmptyState = ({<div className="flex flex-col space-y-2 text-foreground-light">{children}</div>{hasAction && (<div className="flex items-center space-x-2">- {ctaButtonLabel && onClickCta && (+ {ctaButtonLabel && !!ctaUrl ? (+ <Button asChild type="primary">+ <Link href={ctaUrl}>{ctaButtonLabel}</Link>+ </Button>+ ) : ctaButtonLabel && !!onClickCta ? (<ButtonTooltiptype="primary"onClick={onClickCta}@@ -55,7 +62,7 @@ const ProductEmptyState = ({>{ctaButtonLabel}</ButtonTooltip>- )}+ ) : null}{infoButtonUrl && infoButtonLabel ? (<Button type="default" icon={<ExternalLink strokeWidth={1.5} />}><a target="_blank" rel="noreferrer" href={infoButtonUrl}>