feat(toolpath-desktop): html-card graph viz with expandable dead branches#23
Merged
feat(toolpath-desktop): html-card graph viz with expandable dead branches#23
Conversation
…ches
Replaces the dagre-d3-es SVG renderer in the Preview with HTML cards laid
out by @dagrejs/dagre + an SVG edge overlay. The default view shows only
the HEAD-path; each HEAD card that has dead children renders with a
stacked-shadow peek and a small "expand" chip — clicking the chip flips
a key in preview.expandedBranches and the graph re-layouts to include
the dead subtree.
Why: the SVG-node viz didn't scale readably to longer Claude sessions,
and dead-end branches dominated the canvas for no user benefit. Cards
as HTML let us reuse the desktop palette (cream/rust) and show richer
per-step metadata (id, intent, actor, optional timestamps + files) in
the graph itself while keeping the existing detail panel for full diffs.
- Add @dagrejs/dagre; drop d3/@types/d3/dagre-d3-es (now unused).
- Model: replace PreviewSlice.showDead with expandedBranches: Record<string, true>;
add PreviewToggleBranch { nodeId } msg + handler; bump vizEpoch on toggle.
- Rewrite lib/viz.ts as renderCard + dagre-layout + SVG edge paths.
Dead edges render red + dashed; arrowheads via SVG marker defs.
- Preview.svelte: swap <svg> for a <div> container; drop the Dead Ends
checkbox (superseded by per-branch expand); pass new opts.
- styles.css: add .path-graph* + .pg-card* rules (warm palette, actor-
typed border-left, stacked-shadow peek for .pg-card--has-hidden).
- app.svelte + .screen--wide: preview route breaks out of the 560px
screen cap so the graph has room to breathe.
Also includes index.html at the repo root — the self-contained design
prototype the UX was iterated against. Easy to delete if not wanted.
|
🔍 Preview deployed: https://db4e3cdb.toolpath.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
dagre-d3-esSVG renderer in the desktop Preview with HTML cards laid out by@dagrejs/dagreplus an SVG edge overlay.expand/collapsechip that re-layouts the graph including (or re-hiding) that branch.Why
Long Claude sessions produced unreadable, edge-heavy SVG graphs where dead branches dominated the canvas. The new layout:
What changed
Frontend deps (
crates/toolpath-desktop/frontend/package.json)@dagrejs/dagre; droppedd3,@types/d3,dagre-d3-es(no longer used).Model (
types.ts+update.ts)Renderer (
lib/viz.ts)Preview component (
Preview.svelte)Layout (
app.svelte+styles.css)Design prototype (
index.htmlat repo root)Test plan