1
+ import { useCallback } from 'react' ;
1
2
import styled from '@emotion/styled' ;
2
3
3
4
import { Alert } from 'sentry/components/core/alert' ;
@@ -11,6 +12,7 @@ import {t} from 'sentry/locale';
11
12
import { space } from 'sentry/styles/space' ;
12
13
import type { ApiQueryKey } from 'sentry/utils/queryClient' ;
13
14
import { useApiQuery } from 'sentry/utils/queryClient' ;
15
+ import useCrumbHandlers from 'sentry/utils/replays/hooks/useCrumbHandlers' ;
14
16
import useOrganization from 'sentry/utils/useOrganization' ;
15
17
import useProjectFromId from 'sentry/utils/useProjectFromId' ;
16
18
import BreadcrumbRow from 'sentry/views/replays/detail/breadcrumbs/breadcrumbRow' ;
@@ -50,9 +52,17 @@ export default function Ai() {
50
52
51
53
function AiContent ( ) {
52
54
const organization = useOrganization ( ) ;
53
- const { replay} = useReplayContext ( ) ;
55
+ const { replay, setCurrentTime } = useReplayContext ( ) ;
54
56
const replayRecord = replay ?. getReplay ( ) ;
55
57
const project = useProjectFromId ( { project_id : replayRecord ?. project_id } ) ;
58
+ const { onClickTimestamp} = useCrumbHandlers ( ) ;
59
+ const onClickChapterTimestamp = useCallback (
60
+ ( event : React . MouseEvent < Element > , start : number ) => {
61
+ event . stopPropagation ( ) ;
62
+ setCurrentTime ( start - ( replay ?. getStartTimestampMs ( ) ?? 0 ) ) ;
63
+ } ,
64
+ [ replay , setCurrentTime ]
65
+ ) ;
56
66
57
67
const {
58
68
data : summaryData ,
@@ -155,6 +165,9 @@ function AiContent() {
155
165
< TimestampButton
156
166
startTimestampMs = { replay ?. getStartTimestampMs ( ) ?? 0 }
157
167
timestampMs = { start }
168
+ onClick = { event => {
169
+ onClickChapterTimestamp ( event , start ) ;
170
+ } }
158
171
/>
159
172
</ ReplayTimestamp >
160
173
</ SummaryTitle >
@@ -167,7 +180,7 @@ function AiContent() {
167
180
< BreadcrumbRow
168
181
frame = { breadcrumb }
169
182
index = { j }
170
- onClick = { ( ) => { } }
183
+ onClick = { onClickTimestamp }
171
184
onInspectorExpanded = { ( ) => { } }
172
185
onShowSnippet = { ( ) => { } }
173
186
showSnippet = { false }
0 commit comments