1
1
import type { CSSProperties } from 'react' ;
2
- import { useCallback , useEffect , useRef } from 'react' ;
2
+ import { isValidElement , useEffect , useRef } from 'react' ;
3
3
import { useTheme } from '@emotion/react' ;
4
4
import styled from '@emotion/styled' ;
5
5
@@ -8,17 +8,16 @@ import {BreadcrumbCodeSnippet} from 'sentry/components/replays/breadcrumbs/bread
8
8
import { BreadcrumbComparisonButton } from 'sentry/components/replays/breadcrumbs/breadcrumbComparisonButton' ;
9
9
import { BreadcrumbDescription } from 'sentry/components/replays/breadcrumbs/breadcrumbDescription' ;
10
10
import { BreadcrumbIssueLink } from 'sentry/components/replays/breadcrumbs/breadcrumbIssueLink' ;
11
+ import { BreadcrumbStructuredData } from 'sentry/components/replays/breadcrumbs/breadcrumbStructuredData' ;
11
12
import { BreadcrumbWebVital } from 'sentry/components/replays/breadcrumbs/breadcrumbWebVital' ;
12
13
import { Timeline } from 'sentry/components/timeline' ;
13
14
import { space } from 'sentry/styles/space' ;
14
- import { trackAnalytics } from 'sentry/utils/analytics' ;
15
15
import type { Extraction } from 'sentry/utils/replays/extractDomNodes' ;
16
16
import getFrameDetails from 'sentry/utils/replays/getFrameDetails' ;
17
17
import useExtractDomNodes from 'sentry/utils/replays/hooks/useExtractDomNodes' ;
18
18
import { useReplayReader } from 'sentry/utils/replays/playback/providers/replayReaderProvider' ;
19
19
import type { ReplayFrame } from 'sentry/utils/replays/types' ;
20
20
import { isErrorFrame } from 'sentry/utils/replays/types' ;
21
- import useOrganization from 'sentry/utils/useOrganization' ;
22
21
import TimestampButton from 'sentry/views/replays/detail/timestampButton' ;
23
22
import type { OnExpandCallback } from 'sentry/views/replays/detail/useVirtualizedInspector' ;
24
23
@@ -42,7 +41,7 @@ interface Props {
42
41
updateDimensions ?: ( ) => void ;
43
42
}
44
43
45
- function BreadcrumbItem ( {
44
+ export default function BreadcrumbItem ( {
46
45
className,
47
46
frame,
48
47
expandPaths,
@@ -62,7 +61,6 @@ function BreadcrumbItem({
62
61
const { colorGraphicsToken, description, title, icon} = getFrameDetails ( frame ) ;
63
62
const colorHex = theme . tokens . graphics [ colorGraphicsToken ] ;
64
63
const replay = useReplayReader ( ) ;
65
- const organization = useOrganization ( ) ;
66
64
const { data : extraction , isPending} = useExtractDomNodes ( {
67
65
replay,
68
66
frame,
@@ -82,19 +80,6 @@ function BreadcrumbItem({
82
80
}
83
81
} , [ isPending , updateDimensions , showSnippet ] ) ;
84
82
85
- const handleViewHtml = useCallback (
86
- ( e : React . MouseEvent < HTMLButtonElement > ) => {
87
- onShowSnippet ( ) ;
88
- e . preventDefault ( ) ;
89
- e . stopPropagation ( ) ;
90
- trackAnalytics ( 'replay.view-html' , {
91
- organization,
92
- breadcrumb_type : 'category' in frame ? frame . category : 'unknown' ,
93
- } ) ;
94
- } ,
95
- [ onShowSnippet , organization , frame ]
96
- ) ;
97
-
98
83
return (
99
84
< StyledTimelineItem
100
85
ref = { ref }
@@ -120,15 +105,22 @@ function BreadcrumbItem({
120
105
onMouseLeave = { ( ) => onMouseLeave ( frame ) }
121
106
>
122
107
< ErrorBoundary mini >
123
- < BreadcrumbDescription
124
- description = { description }
125
- frame = { frame }
126
- allowShowSnippet = { allowShowSnippet }
127
- showSnippet = { showSnippet }
128
- onClickViewHtml = { handleViewHtml }
129
- expandPaths = { expandPaths }
130
- onInspectorExpanded = { onInspectorExpanded }
131
- />
108
+ { typeof description === 'string' ||
109
+ ( description !== undefined && isValidElement ( description ) ) ? (
110
+ < BreadcrumbDescription
111
+ description = { description }
112
+ frame = { frame }
113
+ allowShowSnippet = { allowShowSnippet }
114
+ showSnippet = { showSnippet }
115
+ onShowSnippet = { onShowSnippet }
116
+ />
117
+ ) : (
118
+ < BreadcrumbStructuredData
119
+ description = { description }
120
+ expandPaths = { expandPaths }
121
+ onInspectorExpanded = { onInspectorExpanded }
122
+ />
123
+ ) }
132
124
< BreadcrumbComparisonButton frame = { frame } replay = { replay } />
133
125
< BreadcrumbWebVital
134
126
frame = { frame }
@@ -183,5 +175,3 @@ const ReplayTimestamp = styled('div')`
183
175
font-size: ${ p => p . theme . fontSize . sm } ;
184
176
align-self: flex-start;
185
177
` ;
186
-
187
- export default BreadcrumbItem ;
0 commit comments