Conversation
Part of mind map refactor: Document Graph is now only accessible via:
- Right-click context menu on markdown files ("Focus in Graph")
- File preview panel action button
Removed:
- GitGraph icon button from FileExplorerPanel header
- onOpenGraphView prop from FileExplorerPanel interface
- isGraphViewOpen and onOpenGraphView props from RightPanel interface
- Corresponding prop passing in App.tsx
Part of the Document Graph → Mind Map refactoring effort. The layout mode setting is being removed in preparation for the new deterministic mind map layout that won't need a force/hierarchical toggle. Changes: - Remove documentGraphLayoutMode from UseSettingsReturn interface - Remove state, setter, and loading logic in useSettings.ts - Remove props passed to DocumentGraphView in App.tsx - Remove "Default Layout Mode" toggle from SettingsModal.tsx - Update CLAUDE.md to remove layoutMode from settings documentation
- Remove Settings2 and RotateCcw imports from lucide-react - Remove ForcePhysicsSettings and DEFAULT_PHYSICS imports from ForceGraph - Remove showPhysicsPanel and physics state variables - Remove the entire Physics Settings button and dropdown panel UI - Remove physics prop from ForceGraph component (uses internal DEFAULT_PHYSICS) - Update click-outside handler to only handle showDepthSlider This simplifies the Document Graph UI as part of the mind map refactor. The ForceGraph component continues to use its internal default physics.
Create new deterministic canvas-based mind map visualization for the Document Graph feature, replacing the physics-based force-directed graph: - MindMapNode/MindMapLink interfaces for typed graph data - MindMapProps requiring centerFilePath (no standalone mode) - calculateMindMapLayout() - BFS layout algorithm that: - Centers focus document in middle - Splits depth-1 docs into alphabetized left/right columns - Clusters external URLs at bottom (sorted by domain) - Supports depth 2+ nodes fanning out from parents - Canvas rendering with themed document/external nodes - Document nodes show title + description with truncation - External nodes render as smaller pills with domain only - Open file icon in document node corners - Keyboard nav: arrows to move, Enter to recenter, O to open - Mouse: click to select, double-click to recenter, drag/scroll - Search highlighting with dimmed non-matching nodes - convertToMindMapData() utility for graphDataBuilder integration
- Update DocumentGraphView.tsx to use MindMap component: - Replace ForceGraph import with MindMap import - Change focusFilePath from optional to required - Update state types to MindMapNode/MindMapLink - Add handleOpenFile callback for mind map navigation - Update footer with mind map keyboard shortcuts - Update App.tsx for required focusFilePath: - Conditionally render DocumentGraphView only when graphFocusFilePath is set - Clear graphFocusFilePath on close - Remove onFocusFileConsumed prop
Remove the Document Graph entry from the Command-K quick actions menu. Document Graph can now only be opened when a specific file is selected, via right-click context menu or file preview panel. - Remove onOpenDocumentGraph prop from QuickActionsModalProps interface - Remove Document Graph action from mainActions array - Remove onOpenDocumentGraph from AppModals.tsx interfaces and usage - Remove onOpenDocumentGraph callback from App.tsx
- Replace circular force-graph node previews with card-style document nodes showing title + description representation - Replace external node circle with pill-shaped domain node - Add keyboard shortcuts section (arrows, Enter, O key) - Update edge previews to use bezier curves matching mind map style - Add KeyboardBadge component for displaying keyboard shortcuts - Update mouse interaction hints (click, double-click, right-click, scroll) - Update descriptions to match new mind map visual design
The force-directed graph visualization has been replaced by a deterministic canvas-based mind map layout. ForceGraph.tsx is no longer used - all imports now reference MindMap.tsx instead.
- Removed react-force-graph-2d from package.json dependencies - Updated DocumentGraphView.tsx header comment to reflect canvas-based MindMap - Ran npm install to clean up package-lock.json (16 packages removed)
- Updated graphDataBuilder.test.ts comment to reference MindMap.tsx instead of ForceGraph.tsx - Rewrote GraphLegend.test.tsx (557 lines) to match new MindMap-style legend: - Updated aria-label expectations from "graph legend" to "Mind map legend" - Node preview tests now expect card-style SVG rects instead of circles - Edge preview tests now expect bezier paths instead of lines with arrow heads - Updated text descriptions for NODE_ITEMS and EDGE_ITEMS - Added tests for Keyboard Shortcuts, Status Indicators, interaction hints - Updated max-width from 280px to 300px - Updated stroke-dasharray from "4 4" to "4 3" for bezier styling
Code Review - PR #127: Graph Visuals UpdateThis is an impressive refactor that replaces the physics-based force-directed graph with a deterministic canvas-based mind map. The implementation is well-structured and follows the codebase conventions. Here's my detailed review: ✅ Strengths1. Architecture & Design
2. Code Quality
3. Accessibility & UX
4. Integration
|
| Metric | Value | Assessment |
|---|---|---|
| Files changed | 16 | Reasonable for refactor |
| Additions | 1,517 | Large but expected |
| Deletions | 1,355 | Good cleanup |
| Net change | +162 | Minimal bloat |
| New component size | 1,141 lines | Consider splitting if grows |
| Test coverage | Partial | Needs improvement |
🚀 Recommendations
High Priority:
- ✅ Fix XSS vulnerability in URL handling
- ✅ Add unit tests for
MindMapcomponent - ✅ Add error boundaries for canvas operations
Medium Priority:
4. Extract duplicate column layout logic
5. Add keyboard focus visual indicator
6. Convert magic numbers to named constants
Low Priority:
7. Consider spatial indexing for large graphs
8. Add performance monitoring for render time
9. Document the layout algorithm with diagrams
✨ Conclusion
This is a well-executed refactor that significantly improves the Document Graph feature. The code is clean, well-documented, and follows the project's conventions (as outlined in CLAUDE.md). The main concerns are:
- Security: XSS vulnerability in external URL handling (must fix)
- Testing: Missing test coverage for core new component (should add)
- Performance: Minor optimization opportunities for large graphs
After addressing the XSS issue and adding basic tests, this PR is ready to merge. The deterministic layout is a major UX improvement over the previous physics-based approach.
Approval Status:
Great work on this refactor! The mind map approach is much more intuitive than force-directed graphs for document relationships.
No description provided.