Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Feat/schema visualizer legend (#21575)

Terry Sutton569f7fcd144d
diff --git a/apps/studio/components/interfaces/Database/Schemas/SchemaGraph.tsx b/apps/studio/components/interfaces/Database/Schemas/SchemaGraph.tsx
index 19587afcb72..ea316a695ac 100644
--- a/apps/studio/components/interfaces/Database/Schemas/SchemaGraph.tsx
+++ b/apps/studio/components/interfaces/Database/Schemas/SchemaGraph.tsx
@@ -20,6 +20,7 @@ import { useTheme } from 'next-themes'
import 'reactflow/dist/style.css'
import { IconLoader } from 'ui'
import { TABLE_NODE_ROW_HEIGHT, TABLE_NODE_WIDTH, TableNode } from 'ui-patterns/SchemaTableNode'
+import SchemaGraphLegend from './SchemaGraphLegend'
type TableNodeData = {
name: string
@@ -259,6 +260,7 @@ const TablesGraph = ({ tables }: { tables: PostgresTable[] }) => {
maskColor={miniMapMaskColor}
className="border rounded-md shadow-sm"
/>
+ <SchemaGraphLegend />
</ReactFlow>
</div>
</>
diff --git a/apps/studio/components/interfaces/Database/Schemas/SchemaGraphLegend.tsx b/apps/studio/components/interfaces/Database/Schemas/SchemaGraphLegend.tsx
new file mode 100644
index 00000000000..acd94d2380a
--- /dev/null
+++ b/apps/studio/components/interfaces/Database/Schemas/SchemaGraphLegend.tsx
@@ -0,0 +1,38 @@
+import { DiamondIcon, Fingerprint, Hash, Key } from 'lucide-react'
+
+const SchemaGraphLegend = () => {
+ return (
+ <div className="absolute bottom-0 left-0 border-t flex justify-center px-1 py-2 shadow-md bg-surface-100 w-full z-10">
+ {/* <h3 className="text-xs font-bold">Legend</h3> */}
+ <ul className="flex flex-wrap items-center justify-center gap-4">
+ <li className="flex items-center text-xs font-mono gap-1">
+ <Key size={15} strokeWidth={1.5} className="flex-shrink-0 text-light" />
+ Primary key
+ </li>
+ <li className="flex items-center text-xs font-mono gap-1">
+ <Hash size={15} strokeWidth={1.5} className="flex-shrink-0 text-light" />
+ Identity
+ </li>
+ <li className="flex items-center text-xs font-mono gap-1">
+ <Fingerprint size={15} strokeWidth={1.5} className="flex-shrink-0 text-light" />
+ Unique
+ </li>
+ <li className="flex items-center text-xs font-mono gap-1">
+ <DiamondIcon size={15} strokeWidth={1.5} className="flex-shrink-0 text-light" />
+ Nullable
+ </li>
+ <li className="flex items-center text-xs font-mono gap-1">
+ <DiamondIcon
+ size={15}
+ strokeWidth={1.5}
+ fill="currentColor"
+ className="flex-shrink-0 text-light"
+ />
+ Non-Nullable
+ </li>
+ </ul>
+ </div>
+ )
+}
+
+export default SchemaGraphLegend