feat: port graph page from playground #78
No reviewers
Labels
No labels
domain:backend
domain:devops
domain:frontend
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
forgejo_admin/pal-e-docs-app!78
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "74-port-graph-page"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
/graphrouteparent_slug, and renders interactive nodes colored bynote_typewith size proportional to recencyChanges
src/routes/graph/+page.svelte-- NEW: SVG graph visualization with force-directed layout, filter pills by note type, clickable nodes navigating to/notes/{slug}, legend matching playground designsrc/routes/graph/+page.ts-- NEW: client-side only route (SSR disabled)src/routes/+layout.svelte-- Added Graph link to top nav bar and sidebar navigationTest Plan
npm run buildpasses with zero errorsnpx svelte-checkpasses with zero errors (1 pre-existing warning in search page)/graphwith nodes and edges from live API data/notes/{slug}Review Checklist
Related Notes
forgejo_admin/pal-e-app#74-- Port graph page from playgroundQA Review -- PR #78
Structure & Patterns
Accessibility
role="link",tabindex="0", keyboard handler for Enter/Space -- good<title>element on each node provides tooltip -- gooda11y_click_events_have_key_eventssuppression is appropriate since keydown is handled on the same elementNits (non-blocking)
O(n^2) repulsion loop -- The force simulation runs
n*(n-1)/2repulsion calculations for 120 iterations synchronously inonMount. With 500 notes this is ~15M iterations. On fast hardware this should complete in <100ms, but if the note count grows significantly, consider a Barnes-Hut approximation or requestAnimationFrame chunking. Not blocking since the current dataset is well within bounds.nodeOpacityoperator precedence --0.5 + (r - 8) / (24 - 8) * 0.4relies on left-to-right evaluation of/and*which is correct, but adding parentheses0.5 + ((r - 8) / (24 - 8)) * 0.4would improve readability.Non-deterministic layout --
Math.random()for initial positions means the graph looks different on every page load. This is fine for exploration but worth noting. A seeded PRNG or slug-based hash could provide stable layouts.GraphEdge.typeincludes 'reference' but no reference edges are created -- ThebuildGraphfunction only createsparenttype edges fromparent_slug. Thereferenceedge type exists in the interface and is handled in the template (dashed lines, accent color), but no code path produces reference edges. This is a placeholder for future note-links API integration, which is fine, but the legend shows "reference" lines that won't appear in practice yet.Unused
projectfield on GraphNode --projectis populated but never read in the template. Minor dead code.Verdict
VERDICT: APPROVE
Clean port from playground. Build passes, type-check clean. The force-directed layout is a solid approach for the current dataset size. Nits are all non-blocking improvements for future iterations.