@@ -29,26 +29,36 @@ import useVirtualizedList from 'sentry/views/replays/detail/useVirtualizedList';
2929
3030type Props = {
3131 replay : null | ReplayReader ;
32+ startTimestampMs : number ;
3233} ;
3334
34- function DomMutations ( { replay} : Props ) {
35- const startTimestampMs = replay ?. getReplay ( ) ?. startedAt ?. getTime ( ) || 0 ;
36- const { currentTime} = useReplayContext ( ) ;
35+ function DomMutations ( { replay, startTimestampMs} : Props ) {
36+ const { currentTime, currentHoverTime} = useReplayContext ( ) ;
3737 const { isLoading, actions} = useExtractedCrumbHtml ( { replay} ) ;
3838
3939 const filterProps = useDomFilters ( { actions : actions || [ ] } ) ;
4040 const { items, setSearchTerm} = filterProps ;
4141 const clearSearchTerm = ( ) => setSearchTerm ( '' ) ;
4242
43- const currentDomMutation = getPrevReplayEvent ( {
44- items : items . map ( mutation => mutation . crumb ) ,
43+ const { handleMouseEnter, handleMouseLeave, handleClick} =
44+ useCrumbHandlers ( startTimestampMs ) ;
45+
46+ const crumbs = items . map ( mutation => mutation . crumb ) ;
47+ const current = getPrevReplayEvent ( {
48+ items : crumbs ,
4549 targetTimestampMs : startTimestampMs + currentTime ,
4650 allowEqual : true ,
4751 allowExact : true ,
4852 } ) ;
4953
50- const { handleMouseEnter, handleMouseLeave, handleClick} =
51- useCrumbHandlers ( startTimestampMs ) ;
54+ const hovered = currentHoverTime
55+ ? getPrevReplayEvent ( {
56+ items : crumbs ,
57+ targetTimestampMs : startTimestampMs + currentHoverTime ,
58+ allowEqual : true ,
59+ allowExact : true ,
60+ } )
61+ : null ;
5262
5363 const listRef = useRef < ReactVirtualizedList > ( null ) ;
5464 const { cache} = useVirtualizedList ( {
@@ -80,7 +90,8 @@ function DomMutations({replay}: Props) {
8090 onMouseEnter = { ( ) => handleMouseEnter ( crumb ) }
8191 onMouseLeave = { ( ) => handleMouseLeave ( crumb ) }
8292 style = { style }
83- isCurrent = { crumb . id === currentDomMutation ?. id }
93+ isCurrent = { crumb . id === current ?. id }
94+ isHovered = { crumb . id === hovered ?. id }
8495 >
8596 < IconWrapper color = { crumb . color } hasOccurred = { hasOccurred } >
8697 < BreadcrumbIcon type = { crumb . type } />
@@ -193,13 +204,16 @@ const IconWrapper = styled('div')<
193204 z-index: 2;
194205` ;
195206
196- const MutationListItem = styled ( 'li' ) < { isCurrent ? : boolean } > `
207+ const MutationListItem = styled ( 'li' ) < { isCurrent : boolean ; isHovered : boolean } > `
197208 display: flex;
198209 gap: ${ space ( 1 ) } ;
199210 flex-grow: 1;
200211 padding: ${ space ( 1 ) } ${ space ( 1.5 ) } ;
201212 position: relative;
202- border-bottom: 1px solid ${ p => ( p . isCurrent ? p . theme . purple300 : 'transparent' ) } ;
213+ border-bottom: 1px solid
214+ ${ p =>
215+ p . isCurrent ? p . theme . purple300 : p . isHovered ? p . theme . purple200 : 'transparent' } ;
216+
203217 &:hover {
204218 background-color: ${ p => p . theme . backgroundSecondary } ;
205219 }
0 commit comments