import type { InteractionMode } from '../types'; import { NODE_TYPES, NODE_COLORS, NODE_TYPE_LABELS } from '../constants'; interface Props { mode: InteractionMode; addNodeType: string; onAddNodeTypeChange: (type: string) => void; onSetMode: (mode: InteractionMode) => void; onUndo: () => void; onRedo: () => void; undoCount: number; redoCount: number; } const HINTS: Partial> = { 'add-node': 'Click an empty spot on the graph to drop a node.', 'add-edge': 'Click one node, then another, to connect them.', delete: 'Click any node or edge to remove it.', }; export default function EditPanel({ mode, addNodeType, onAddNodeTypeChange, onSetMode, onUndo, onRedo, undoCount, redoCount, }: Props) { const tool = (m: InteractionMode, label: string) => ( ); return (

Edit Graph

Fix extraction defects by hand. Add or remove nodes and edges directly on the canvas.

{tool('add-node', 'Add Node')} {tool('add-edge', 'Add Edge')} {tool('delete', 'Delete')}
{mode === 'add-node' && (
{NODE_TYPES.map((t) => ( ))}
)} {HINTS[mode] &&
{HINTS[mode]}
}

Every change is undoable and redoable, all the way back to the originally extracted graph.

); }