Skip to content

Feature/obsidian graph view - #20

Merged
MaximilianRau04 merged 7 commits into
mainfrom
feature/obsidian-graph-view
Aug 24, 2026
Merged

MaximilianRau04 merged 7 commits into
mainfrom
feature/obsidian-graph-view

Conversation

@priyanshuvishwakarma273403

Copy link
Copy Markdown
Collaborator

Overview

This PR implements an interactive, Obsidian-style knowledge graph view for visualizing documents, parties, clauses, and their relationships. It replaces the minimal graph rendering with a fully interactive canvas simulation.

Key Changes

1. Interactive Graph Visualization (packages/graph-view/src/GraphView.tsx)

  • Typed Nodes & Edges: Renders Documents (Blue), Parties (Emerald), and Clauses (Purple) as nodes, along with background badge labels showing relationship types (e.g. 'signed_by', 'contains') directly on the links.
  • Pan & Zoom: Supports zooming with mouse-wheel coordinates centering, and panning by clicking and dragging the canvas background. Exposes reset capabilities.
  • Node Dragging: Allows users to click and drag nodes dynamically. Re-evaluates force simulations on the fly.
  • Entity Filters: Added a floating overlay to toggle visibility of Documents, Parties, and Clauses. Re-runs force layouts only for the visible subsets.
  • Halo Text Outlines: Implements text halos/outlines under node labels to guarantee clear legibility even when overlapping relationship lines.
  • Positional Cache: Retains previously calculated node coordinates so that adding, filtering, or updating nodes does not cause existing nodes to jitter or fly around.

2. SQLite Entity Loading & Navigation (apps/web/src/App.tsx & packages/data/src/store.ts)

  • Added getClauses() retrieval methods to the SQLite data layer.
  • Maps SQLite data model entities dynamically into the React state and updates graph nodes/edges seamlessly.
  • Implements onNodeClick navigation:
    • Clicking a Document node opens it in the reader panel.
    • Clicking a Clause node opens its parent document and automatically scrolls/highlights the exact clause text passage.
    • Clicking a Party node opens the first document signed by that party.
  • Seeds comprehensive sample data (contracts, signee parties, payment/term clauses, and containment/signing relationships) on initial run.

Verification Results

  • pnpm lint: Passed (0 warnings/errors)
  • pnpm test: Passed (14/14 tests)

@MaximilianRau04 MaximilianRau04 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Graph rendering and data wiring are solid, but node dragging as described in the PR does not actually work.

Comment thread packages/graph-view/src/GraphView.tsx Resolved

@MaximilianRau04 MaximilianRau04 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified: drag now correctly references the live simNodes via a ref, and mousemove/mouseup already pointed at the same ref. Actually works now. One non-blocking edge case noted inline. Approving.

@MaximilianRau04 MaximilianRau04 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking nit, not a re-request.

Comment thread packages/graph-view/src/GraphView.tsx Resolved
…ng drag ref on re-render

Addresses non-blocking review nit on #20: filteredNodes/filteredEdges were
recomputed on every render and were the sim useEffect's deps, so an
unrelated parent re-render mid-drag could rebuild simNodesRef.current and
orphan draggedNodeRef.current. Now memoized on their actual inputs.
@MaximilianRau04
MaximilianRau04 merged commit 81ff7e6 into main Aug 24, 2026
1 check passed
@MaximilianRau04
MaximilianRau04 deleted the feature/obsidian-graph-view branch August 24, 2026 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants