Files
OpenResearch/ui
Daniel Kim 17633be723 Add a hover detail card to experiment tree nodes (v0.1.83) (#133)
* Add a hover detail card to experiment tree nodes (v0.1.83)

Hovering a node in the experiment tree (350ms intent delay) opens a
portal-anchored card with the full title/description, run stats
(counts, backend, duration), a lazily fetched diffstat vs the parent
branch, branch lineage, and the run command. Portaled to <body> so it
neither scales with canvas zoom nor disturbs the fixed tree layout;
dismissed on mouse-out or canvas wheel.

* Review round 1: shared diff parser, viewport-change dismissal, honest counts

- Parse the diffstat with react-diff-view's parseDiff + the Changes tab's
  countChanges/formatDiffFilePath (now exported) instead of a hand-rolled
  scanner; truncated diffs render as lower bounds.
- Replace the global wheel listener with useOnViewportChange dismissal
  (covers drag-pan, pinch, fitView) and re-measure the anchor when tree
  data changes; position via the existing useMeasure/usePopoverPosition.
- Fix duplicate failure text, 'passed'→'done' wording, reconciled run
  counts, live-run duration fallback, mono font-size leak, z-index tier,
  and reuse diff-stat-add/del classes.

* Review round 2: reliable pan/zoom dismissal, truncation-safe parsing, side fallback

- useOnViewportChange stores a single global callback, so per-node
  registrations overwrote each other; dismissal now flows from ReactFlow's
  onMoveStart through a module-level EventTarget every open card subscribes to.
- Byte-capped diffs can cut mid-hunk and crash parseDiff; trim to the last
  complete file (or line) first, try/catch as a backstop, and hide the row
  for empty diffs.
- On windows too narrow for either side placement, anchor above/below
  instead of letting the clamp sit the card on top of its own node.
- Skip rect churn on SSE ticks that don't move the node.

* Review round 3: reset diffstat on run change; label truncated file count

The diffstat effect never cleared state, so when SSE flipped latestRun
while a card was open the old run's counts lingered beside the new run's
status (and a failed refetch kept them forever). Reset at the top of the
effect. Also mark the file count as a lower bound on truncated diffs and
align the cancellation-flag name with the codebase idiom.

* Skip header-only diffstat remnant after truncation trim

* Hover card feedback: expandable description, darker text, drop file names

- Clamped descriptions get a Show more / Show less toggle; expanded text
  scrolls within the card instead of growing past the viewport.
- Title, stats and git rows read in --text instead of --muted (the card
  was mostly grey); the foot row stays muted as tertiary metadata.
- Diffstat keeps branch and +/− counts, drops the changed-file list.

* Drop the description's recessed background for hairline rules

The filled box was the only non-hairline surface on the card and read as
a heavy slab on long results; the description is now plain text between
the same hairline rules the rest of the app uses.

* Post-feedback review nits: toggle hygiene and hairline polish

Reset the expanded state when SSE swaps the description; type=button on
the toggle; trim CSS the global button reset already provides; bottom
padding on the expanded scroll body; comment accuracy.
2026-07-27 17:37:48 -07:00
..
2026-07-06 20:05:41 -07:00
2026-07-06 20:05:41 -07:00
2026-07-06 20:05:41 -07:00