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): add minimap for better view on large schemas (#16708)

Ryan Martin2f2696e63574
diff --git a/studio/components/interfaces/Database/Schemas/SchemaGraph.tsx b/studio/components/interfaces/Database/Schemas/SchemaGraph.tsx
index c2701e5e5b2..4fb1bd23fa6 100644
--- a/studio/components/interfaces/Database/Schemas/SchemaGraph.tsx
+++ b/studio/components/interfaces/Database/Schemas/SchemaGraph.tsx
@@ -9,6 +9,7 @@ import ReactFlow, {
BackgroundVariant,
Edge,
Handle,
+ MiniMap,
Node,
NodeProps,
Position,
@@ -303,6 +304,8 @@ const TablesGraph = ({ tables }: { tables: PostgresTable[] }) => {
const { isDarkMode } = useTheme()
const backgroundPatternColor = isDarkMode ? '#2e2e2e' : '#e6e8eb'
const edgeStrokeColor = isDarkMode ? '#ededed' : '#111318'
+ const miniMapNodeColor = '#111318'
+ const miniMapMaskColor = isDarkMode ? 'rgb(17, 19, 24, .8)' : 'rgb(237, 237, 237, .8)'
const reactFlowInstance = useReactFlow()
const nodeTypes = useMemo(
@@ -336,10 +339,18 @@ const TablesGraph = ({ tables }: { tables: PostgresTable[] }) => {
}}
nodeTypes={nodeTypes}
fitView
- maxZoom={1.5}
+ minZoom={0.8}
+ maxZoom={1.8}
proOptions={{ hideAttribution: true }}
>
<Background gap={16} color={backgroundPatternColor} variant={BackgroundVariant.Lines} />
+ <MiniMap
+ pannable
+ zoomable
+ nodeColor={miniMapNodeColor}
+ maskColor={miniMapMaskColor}
+ className="border border-scale-600 rounded-md shadow-sm"
+ />
</ReactFlow>
</div>
</>