feat: minimap toggle

This commit is contained in:
2026-03-11 13:44:48 +01:00
parent 1cc6b98973
commit 95e1c13dcd
3 changed files with 24 additions and 8 deletions

View File

@@ -190,6 +190,7 @@ export function CanvasPage({ projectId }: CanvasPageProps) {
const [lastCreatedNodeId, setLastCreatedNodeId] = React.useState<string | null>(null)
const [isPanning, setIsPanning] = React.useState(false)
const [isSelecting, setIsSelecting] = React.useState(false)
const [showMinimap, setShowMinimap] = React.useState(true)
const [ariaAnnouncement, setAriaAnnouncement] = React.useState<string | null>(null)
const nodesRef = useRef(nodes)
nodesRef.current = nodes
@@ -569,6 +570,8 @@ export function CanvasPage({ projectId }: CanvasPageProps) {
canDuplicate={selectedNodes.length > 0}
canCopy={selectedNodes.length === 1}
onFitView={() => flowActionsRef.current?.fitView?.()}
showMinimap={showMinimap}
onToggleMinimap={setShowMinimap}
/>
{apiTodosCount !== null && (
<div className="shrink-0 px-3 py-1 text-xs text-muted-foreground border-b border-border/50">
@@ -662,9 +665,11 @@ export function CanvasPage({ projectId }: CanvasPageProps) {
<div role="group" aria-label="Canvas controls: zoom and fit view">
<Controls />
</div>
<div role="region" aria-label="Minimap: overview of the graph">
<MiniMap />
</div>
{showMinimap && (
<div role="region" aria-label="Minimap: overview of the graph">
<MiniMap />
</div>
)}
</ReactFlow>
</ReactFlowProvider>
</div>