feat: canvas options

This commit is contained in:
2026-03-11 14:17:12 +01:00
parent 581cfca506
commit 94da42f9fc
4 changed files with 49 additions and 19 deletions

View File

@@ -34,8 +34,6 @@ export type CanvasMenubarProps = {
canDuplicate?: boolean
canCopy?: boolean
onFitView?: () => void
showMinimap?: boolean
onToggleMinimap?: (visible: boolean) => void
}
const UNDO_KEYS = { key: 'z', shiftKey: false }
@@ -59,8 +57,6 @@ export function CanvasMenubar({
canDuplicate = false,
canCopy = false,
onFitView,
showMinimap = false,
onToggleMinimap,
}: CanvasMenubarProps) {
const { projectId } = useParams<{ projectId: string }>()
const { projects, renameProject } = usePlatform()
@@ -233,18 +229,6 @@ export function CanvasMenubar({
</span>
</MenubarItem>
)}
{onToggleMinimap != null && (
<>
<MenubarSeparator />
<MenubarCheckboxItem
checked={showMinimap}
onCheckedChange={(checked) => onToggleMinimap(checked)}
className="gap-2"
>
Minimap
</MenubarCheckboxItem>
</>
)}
</MenubarContent>
</MenubarMenu>
</Menubar>

View File

@@ -25,6 +25,7 @@ import {
import { AnimatedEdge } from '@/components/base/AnimatedEdge'
import FlowContext from '@/lib/flowContext'
import { useTheme } from '@/lib/themeContext'
import { usePlatform } from '@/app/platform/platformContext'
import { useGraphStateWithHistory } from '@/hooks/useGraphStateWithHistory'
import {
ContextMenu,
@@ -148,6 +149,7 @@ function getInitialGraph(projectId: string | undefined): { nodes: AppNode[]; edg
export function CanvasPage({ projectId }: CanvasPageProps) {
const { theme } = useTheme()
const { showMinimap } = usePlatform()
const initialGraph = useMemo(() => getInitialGraph(projectId), [projectId])
const {
nodes,
@@ -190,7 +192,6 @@ 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(false)
const [ariaAnnouncement, setAriaAnnouncement] = React.useState<string | null>(null)
const nodesRef = useRef(nodes)
nodesRef.current = nodes
@@ -570,8 +571,6 @@ 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">