diff --git a/apps/web/src/components/chat/MessagesTimeline.logic.ts b/apps/web/src/components/chat/MessagesTimeline.logic.ts index 6729c66578..a34db0e1cf 100644 --- a/apps/web/src/components/chat/MessagesTimeline.logic.ts +++ b/apps/web/src/components/chat/MessagesTimeline.logic.ts @@ -10,7 +10,7 @@ import { type ChatMessage, type ProposedPlan, type TurnDiffSummary } from "../.. import { type MessageId, type OrchestrationLatestTurn, type TurnId } from "@t3tools/contracts"; export const MAX_VISIBLE_WORK_LOG_ENTRIES = 1; -export const TIMELINE_MINIMAP_HEIGHT = 180; +export const TIMELINE_MINIMAP_ITEM_SPACING = 8; export const TIMELINE_MINIMAP_MIN_ITEMS = 2; export interface TimelineEndState { diff --git a/apps/web/src/components/chat/MessagesTimeline.tsx b/apps/web/src/components/chat/MessagesTimeline.tsx index 606a58da04..0ccb619ef4 100644 --- a/apps/web/src/components/chat/MessagesTimeline.tsx +++ b/apps/web/src/components/chat/MessagesTimeline.tsx @@ -72,7 +72,7 @@ import { resolveTimelineIsAtEnd, type StableMessagesTimelineRowsState, type MessagesTimelineRow, - TIMELINE_MINIMAP_HEIGHT, + TIMELINE_MINIMAP_ITEM_SPACING, TIMELINE_MINIMAP_MIN_ITEMS, type TimelineLatestTurn, } from "./MessagesTimeline.logic"; @@ -347,13 +347,10 @@ export const MessagesTimeline = memo(function MessagesTimeline({ return; } - const contentLength = Math.max(1, state.contentLength ?? 0); const scrollTop = state.scroll ?? 0; const scrollBottom = scrollTop + (state.scrollLength ?? 0); - const fallbackStep = - minimapItems.length > 1 ? TIMELINE_MINIMAP_HEIGHT / (minimapItems.length - 1) : 0; - for (const [fallbackIndex, item] of minimapItems.entries()) { + for (const item of minimapItems) { const strip = minimapStripRefs.current.get(item.id); if (!strip) { continue; @@ -361,19 +358,11 @@ export const MessagesTimeline = memo(function MessagesTimeline({ const rowTop = resolveTimelineRowTop(state, item.rowIndex); const rowHeight = resolveTimelineRowHeight(state, item.rowIndex); - const top = - rowTop === null - ? fallbackIndex * fallbackStep - : Math.min( - TIMELINE_MINIMAP_HEIGHT, - Math.max(0, (rowTop / contentLength) * TIMELINE_MINIMAP_HEIGHT), - ); const inView = rowTop !== null && rowTop < scrollBottom && rowTop + Math.max(1, rowHeight ?? 1) > scrollTop; - strip.style.top = `${top}px`; strip.dataset.inView = inView ? "true" : "false"; } }, [listRef, minimapItems, onIsAtEndChange]); @@ -573,21 +562,41 @@ function TimelineMinimap({ return null; } - const fallbackStep = items.length > 1 ? TIMELINE_MINIMAP_HEIGHT / (items.length - 1) : 0; + const minimapHeight = Math.max(1, (items.length - 1) * TIMELINE_MINIMAP_ITEM_SPACING); return (
-
+ +
{items.map((item, index) => { - const top = index * fallbackStep; + const top = index * TIMELINE_MINIMAP_ITEM_SPACING; return (