@@ -75,6 +75,7 @@ import {
7575 resolveTimelineMinimapHeightStyle ,
7676 resolveTimelineMinimapHitStripWidth ,
7777 resolveTimelineMinimapIndexFromPointer ,
78+ resolveTimelineMinimapInteractiveWidth ,
7879 resolveTimelineMinimapTopPercent ,
7980 type StableMessagesTimelineRowsState ,
8081 type MessagesTimelineRow ,
@@ -604,6 +605,10 @@ function resolveTimelineRowHeight(state: TimelinePositionState, rowIndex: number
604605 return typeof height === "number" && Number . isFinite ( height ) ? height : null ;
605606}
606607
608+ function timelineMinimapEventTargetsPreview ( target : EventTarget ) : boolean {
609+ return target instanceof Element && target . closest ( "[data-minimap-preview]" ) !== null ;
610+ }
611+
607612function TimelineMinimap ( {
608613 bottomInset,
609614 hasPersistentGutter,
@@ -697,6 +702,9 @@ function TimelineMinimap({
697702 ) }
698703 onBlur = { ( ) => setActiveIndex ( null ) }
699704 onClick = { ( event ) => {
705+ if ( timelineMinimapEventTargetsPreview ( event . target ) ) {
706+ return ;
707+ }
700708 const nextIndex = resolveActiveIndexFromPointer ( event ) ;
701709 const nextItem = nextIndex === null ? null : ( items [ nextIndex ] ?? null ) ;
702710 if ( nextItem ) {
@@ -728,11 +736,14 @@ function TimelineMinimap({
728736 onMouseLeave = { ( ) => setActiveIndex ( null ) }
729737 onMouseMove = { updateActiveIndexFromPointer }
730738 onMouseDown = { ( event ) => {
739+ if ( timelineMinimapEventTargetsPreview ( event . target ) ) {
740+ return ;
741+ }
731742 event . preventDefault ( ) ;
732743 } }
733744 style = { {
734745 height : resolveTimelineMinimapHeightStyle ( items . length ) ,
735- width : hitStripWidth ,
746+ width : resolveTimelineMinimapInteractiveWidth ( hitStripWidth , activeItem !== null ) ,
736747 } }
737748 type = "button"
738749 >
@@ -770,27 +781,31 @@ function TimelineMinimap({
770781 } ) }
771782 { activeItem ? (
772783 < span
773- className = "pointer-events-none absolute left-8 w-80 rounded-xl border border-border/70 bg-popover/95 p-3 text-left text-popover-foreground shadow-xl shadow-black/25 backdrop-blur"
784+ className = "pointer-events-auto absolute left-8 w-80 cursor-text select-text"
785+ data-minimap-preview
786+ onMouseMove = { ( event ) => event . stopPropagation ( ) }
774787 style = { {
775788 top : `${ activeTopPercent } %` ,
776789 transform : `translateY(${ activeTooltipTranslate } )` ,
777790 } }
778791 >
779- < span className = "block max-w-full overflow-hidden text-ellipsis whitespace-nowrap text-sm font-medium leading-5" >
780- { activeItem . userText ?? "User message" }
781- </ span >
782- { activeItem . assistantText ? (
783- < span
784- className = "mt-1 max-h-[3.75rem] overflow-hidden text-muted-foreground text-sm leading-5"
785- style = { {
786- display : "-webkit-box" ,
787- WebkitBoxOrient : "vertical" ,
788- WebkitLineClamp : 3 ,
789- } }
790- >
791- { activeItem . assistantText }
792+ < span className = "block rounded-xl border border-border/70 bg-popover/95 p-3 text-left text-popover-foreground shadow-xl shadow-black/25 backdrop-blur" >
793+ < span className = "block max-w-full overflow-hidden text-ellipsis whitespace-nowrap text-sm font-medium leading-5" >
794+ { activeItem . userText ?? "User message" }
792795 </ span >
793- ) : null }
796+ { activeItem . assistantText ? (
797+ < span
798+ className = "mt-1 max-h-[3.75rem] overflow-hidden text-muted-foreground text-sm leading-5"
799+ style = { {
800+ display : "-webkit-box" ,
801+ WebkitBoxOrient : "vertical" ,
802+ WebkitLineClamp : 3 ,
803+ } }
804+ >
805+ { activeItem . assistantText }
806+ </ span >
807+ ) : null }
808+ </ span >
794809 </ span >
795810 ) : null }
796811 </ button >
0 commit comments