feat(ui): add ChatHistorySidebar message rail with Storybook setup
What
Adds ChatHistorySidebar to packages/ui — a vertical minimap rail for chat transcripts: one tick bar per user message, with a hover magnification effect and a floating preview card showing the hovered exchange. Also sets up Storybook in packages/ui for the first time (Storybook 10, react-vite, Tailwind v4, dark/light toolbar toggle).
Component behavior
- Rail ticks — equal width/color at rest (
muted-foreground@ 40%). On hover, bars grow viascaleXwith a falloff across ±3 neighbors (1 / 0.7 / 0.4 / 0.2), implemented purely in CSS with sibling selectors +:has()and a springylinear()easing — no JS on the hot path. Only the directly hovered bar changes color to full foreground. - Hover card — anchored to the hovered row: user message (truncated title) + assistant response (3-line clamp), glides between rows.
- Visible-range highlight — rows for every turn currently on screen render at 60% foreground (
aria-current), not just the nearest one. A turn counts as visible if its user message or any of its responses is on screen. - Long conversations — no cap on rendered rows; the list is height-capped at
min(70vh, 40rem)with internal scrolling, hidden scrollbar, a scroll-driven edge fade mask (animation-timeline: scroll(self y)), and follow-scroll that keeps the whole active band in view (bottom edge included, so the last turns stay lit at transcript end). - Hides entirely below 4 user messages.
prefers-reduced-motiondisables the width transition.
shadcn chat ecosystem
ChatHistorySidebarScroller binds the rail to @shadcn/react/message-scroller (new dep): clicks call scrollToMessage(id), and useMessageScrollerVisibility().visibleMessageIds drives the range highlight. The base component stays presentational (messages / activeMessageIds / onMessageSelect) for use outside a MessageScroller.Provider. Exported as @superset/ui/chat-history-sidebar.
Stories
Default / ManyMessages / FewMessages render a full MessageScroller stack (Provider → Root → Viewport → Content → Items + jump-to-latest button); SidebarOnly and HiddenBelowFourMessages cover the standalone states. Run with bun run storybook in packages/ui.
Verification
Typecheck + lint clean. Verified end-to-end in headless Chrome via CDP: hover magnification + card, click → scroll-to-turn, range highlight tracking scroll position, rail follow-scroll at transcript bottom (last rows lit, bottom fade released), and edge fades mid-scroll on 60-row conversations.
https://claude.ai/code/session_0114z2gU9LFJjbwSiyfLTkzY
Summary by cubic
Add a chat history minimap rail to @superset/ui and set up Storybook for packages/ui. ChatHistorySidebar shows one tick per user message with hover magnification, a floating preview, and scroll linking via @shadcn/react/message-scroller.
-
New Features
- Exports
ChatHistorySidebarandChatHistorySidebarScrollerfrom@superset/ui/chat-history-sidebar; scroller wires clicks and visible-range to@shadcn/react/message-scroller(scroller is nested under the component folder; public API unchanged). - CSS-only hover magnification with falloff; floating preview card; visible-range highlighting; keeps the active band in view; clears hover on focus-out; hides below 4 user messages; height-capped list with a scroll-driven edge fade; respects
prefers-reduced-motion.
- Exports
-
Storybook
- Adds Storybook 10 via
@storybook/react-vitewith Tailwind v4 (@tailwindcss/vite) and a dark/light toolbar toggle; scripts:storybook,build-storybook; aligns Storybook andvite@7versions with the workspace to avoid plugin mismatches. - Stories: Default, ManyMessages, FewMessages, SidebarOnly, HiddenBelowFourMessages; wired to controls.
- Adds Storybook 10 via
Summary by CodeRabbit
- New Features
- Added a chat history sidebar with selectable conversation markers, assistant previews, and active-message highlighting.
- Added automatic scrolling and smooth navigation to keep the current conversation in view.
- Added support for sidebar-only layouts and hiding the sidebar when fewer than four messages are available.
- Added light and dark theme controls, keyboard focus states, and reduced-motion support.
- Added Storybook examples covering common chat history scenarios.