mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 15:39:13 +00:00
## Problem The `Trace` primitives in `ui-patterns` only supported panning and zooming through the minimap, and had no way to show summary facts about a trace. Using them for a real trace view in Unified Logs needs direct manipulation on the waterfall itself, a resizable span column for long span names, and a place to put trace-level stats. Part 1 of 3. This PR is design-system only — nothing in Studio consumes it yet. ## Solution **Direct manipulation on the waterfall** - Drag across the timeline to pan, wheel to zoom around the pointer. Panning only starts past a small threshold, so a drag never selects the row it ends on. - `Trace.Scrubber` follows the pointer with the offset from the trace start. - The span column is resizable by a focusable separator: drag it, nudge with the arrow keys, or jump to its bounds with Home and End. The timeline is kept above a minimum width so the tree can't be dragged over it. **Minimap** - Dragging outside the brush now selects a new window. Dragging the brush still pans and dragging an edge still resizes; a plain click outside still recentres. **New parts** - `Trace.Summary` / `Trace.SummaryItem`, with `Trace.TotalDuration`, `Trace.SpanCount` and `Trace.Depth` as values. **Visual** - Leaf rows get an elbow connecting them to their parent's guide, so the tree reads as a tree rather than floating dots. - Minor ruler ticks between the labelled ones, and a shorter ruler, which also shortens the span header. **One breaking change:** `Trace.Minimap` is now passed to `Trace.Waterfall`'s `minimap` prop instead of being a child, so it sits outside the area that handles pointer gestures. Both demos and the docs page are updated to match; these are the only consumers in the repo. ## Review instructions 1. Open the design-system preview and go to **UI Patterns → Tracing**. 2. On the first demo, drag left and right across the timeline to pan, and scroll to zoom — the zoom should stay anchored under the pointer. 3. Drag a span bar and release on it. It should pan, not select the row. 4. Drag the divider between the span column and the timeline. Then tab to it and use the arrow keys, Home and End — the handle should move from where it appears, and End should reach the far edge. 5. Move the pointer across the timeline and confirm the scrubber line tracks it with a readable offset. 6. Check the summary strip above the waterfall shows Duration, Depth and Total Spans. 7. On the minimap: drag the brush to pan, drag an edge to resize, drag outside the brush to select a new window, and click outside it to recentre. Zoom all the way in and confirm the brush stays wide enough to grab. 8. Scroll the docs page and confirm the code sample matches what the demos actually do.