From fd61203be40c3e7a6505fb026c4554355bdd64e5 Mon Sep 17 00:00:00 2001 From: Xubin Ren <52506698+Re-bin@users.noreply.github.com> Date: Tue, 2 Jun 2026 15:29:56 +0800 Subject: [PATCH] feat(webui): bucket dense prompt rails --- webui/src/components/thread/PromptRail.tsx | 81 ++++++++++++++++++++-- webui/src/tests/thread-viewport.test.tsx | 52 ++++++++++++++ 2 files changed, 127 insertions(+), 6 deletions(-) diff --git a/webui/src/components/thread/PromptRail.tsx b/webui/src/components/thread/PromptRail.tsx index 415893b8c..7bcf605f9 100644 --- a/webui/src/components/thread/PromptRail.tsx +++ b/webui/src/components/thread/PromptRail.tsx @@ -27,6 +27,7 @@ interface MeasuredPrompt extends PromptAnchor { } interface PromptMarker { + count: number; ids: string[]; label: string; topPercent: number; @@ -34,7 +35,13 @@ interface PromptMarker { const MIN_PROMPTS_FOR_RAIL = 3; const RAIL_MIN_SCROLL_RANGE_PX = 240; +const DENSE_PROMPT_THRESHOLD = 30; +const DENSE_BUCKET_HEIGHT_PX = 12; +const DENSE_BUCKET_FALLBACK_COUNT = 32; +const DENSE_BUCKET_MAX_COUNT = 42; const MARKER_MIN_GAP_PX = 9; +const MARKER_BASE_WIDTH_PX = 26; +const MARKER_MAX_WIDTH_PX = 42; export function PromptRail({ bottomOffset, @@ -100,12 +107,14 @@ export function PromptRail({ if (markers.length === 0) return null; + const maxMarkerCount = Math.max(...markers.map((marker) => marker.count)); + return (