1
- import type { ReactNode } from 'react' ;
2
- import { useCallback , useMemo } from 'react' ;
3
- import styled from '@emotion/styled' ;
1
+ import { useCallback } from 'react' ;
4
2
5
3
import Feature from 'sentry/components/acl/feature' ;
6
4
import { FeatureBadge } from 'sentry/components/core/badge/featureBadge' ;
7
- import { LinkButton } from 'sentry/components/core/button' ;
5
+ import { Button , LinkButton } from 'sentry/components/core/button' ;
8
6
import { ButtonBar } from 'sentry/components/core/button/buttonBar' ;
9
- import DropdownButton from 'sentry/components/dropdownButton' ;
10
- import { DropdownMenu } from 'sentry/components/dropdownMenu' ;
7
+ import FeedbackWidgetButton from 'sentry/components/feedback/widget/feedbackWidgetButton' ;
11
8
import * as Layout from 'sentry/components/layouts/thirds' ;
12
9
import PageFiltersContainer from 'sentry/components/organizations/pageFilters/container' ;
13
10
import { PageHeadingQuestionTooltip } from 'sentry/components/pageHeadingQuestionTooltip' ;
14
11
import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle' ;
15
- import { TourContextProvider } from 'sentry/components/tours/components' ;
16
- import { useAssistant } from 'sentry/components/tours/useAssistant' ;
17
- import { IconMegaphone } from 'sentry/icons/iconMegaphone' ;
18
12
import { t } from 'sentry/locale' ;
19
- import type { Organization } from 'sentry/types/organization' ;
20
13
import { defined } from 'sentry/utils' ;
21
- import { trackAnalytics } from 'sentry/utils/analytics' ;
22
- import { useFeedbackForm } from 'sentry/utils/useFeedbackForm' ;
23
14
import { useLocation } from 'sentry/utils/useLocation' ;
24
15
import { useNavigate } from 'sentry/utils/useNavigate' ;
25
16
import useOrganization from 'sentry/utils/useOrganization' ;
26
17
import ExploreBreadcrumb from 'sentry/views/explore/components/breadcrumb' ;
27
18
import { getIdFromLocation } from 'sentry/views/explore/contexts/pageParamsContext/id' ;
28
19
import { getTitleFromLocation } from 'sentry/views/explore/contexts/pageParamsContext/title' ;
29
20
import { SpansTabContent } from 'sentry/views/explore/spans/spansTab' ;
30
- import {
31
- EXPLORE_SPANS_TOUR_GUIDE_KEY ,
32
- type ExploreSpansTour ,
33
- ExploreSpansTourContext ,
34
- ORDERED_EXPLORE_SPANS_TOUR ,
35
- useExploreSpansTourModal ,
36
- } from 'sentry/views/explore/spans/tour' ;
37
- import { useExploreSpansTour } from 'sentry/views/explore/spans/tour' ;
38
21
import { limitMaxPickableDays } from 'sentry/views/explore/utils' ;
39
22
import { usePrefersStackedNav } from 'sentry/views/nav/prefersStackedNav' ;
40
23
41
24
export function ExploreContent ( ) {
42
- return (
43
- < SpansTabTour >
44
- < ExploreContentImpl />
45
- </ SpansTabTour >
46
- ) ;
47
- }
48
-
49
- function ExploreContentImpl ( ) {
50
25
const organization = useOrganization ( ) ;
51
26
const { defaultPeriod, maxPickableDays, relativeOptions} =
52
27
limitMaxPickableDays ( organization ) ;
53
28
const prefersStackedNav = usePrefersStackedNav ( ) ;
54
29
55
30
const location = useLocation ( ) ;
31
+ const navigate = useNavigate ( ) ;
32
+ const switchToOldTraceExplorer = useCallback ( ( ) => {
33
+ navigate ( {
34
+ ...location ,
35
+ query : {
36
+ ...location . query ,
37
+ view : 'trace' ,
38
+ } ,
39
+ } ) ;
40
+ } , [ location , navigate ] ) ;
56
41
57
42
const hasSavedQueries = organization . features . includes ( 'performance-saved-queries' ) ;
58
43
59
44
const title = getTitleFromLocation ( location ) ;
60
45
const id = getIdFromLocation ( location ) ;
61
46
62
- useExploreSpansTourModal ( ) ;
63
-
64
47
return (
65
48
< SentryDocumentTitle title = { t ( 'Traces' ) } orgSlug = { organization ?. slug } >
66
49
< PageFiltersContainer maxPickableDays = { maxPickableDays } >
@@ -89,6 +72,11 @@ function ExploreContentImpl() {
89
72
</ Layout . HeaderContent >
90
73
< Layout . HeaderActions >
91
74
< ButtonBar gap = { 1 } >
75
+ < Feature organization = { organization } features = "visibility-explore-admin" >
76
+ < Button onClick = { switchToOldTraceExplorer } size = "sm" >
77
+ { t ( 'Switch to Old Trace Explore' ) }
78
+ </ Button >
79
+ </ Feature >
92
80
{ ! prefersStackedNav && (
93
81
< Feature
94
82
organization = { organization }
@@ -102,7 +90,7 @@ function ExploreContentImpl() {
102
90
</ LinkButton >
103
91
</ Feature >
104
92
) }
105
- < ActionsButton organization = { organization } />
93
+ < FeedbackWidgetButton />
106
94
</ ButtonBar >
107
95
</ Layout . HeaderActions >
108
96
</ Layout . Header >
@@ -116,106 +104,3 @@ function ExploreContentImpl() {
116
104
</ SentryDocumentTitle >
117
105
) ;
118
106
}
119
-
120
- interface SpansTabTourProps {
121
- children : ReactNode ;
122
- }
123
-
124
- function SpansTabTour ( { children} : SpansTabTourProps ) {
125
- const { data : assistantData } = useAssistant ( ) ;
126
- const isTourCompleted = useMemo ( ( ) => {
127
- const tourData = assistantData ?. find (
128
- item => item . guide === EXPLORE_SPANS_TOUR_GUIDE_KEY
129
- ) ;
130
-
131
- // Prevent tour from showing until assistant data is loaded
132
- return tourData ?. seen ?? true ;
133
- } , [ assistantData ] ) ;
134
-
135
- return (
136
- < TourContextProvider < ExploreSpansTour >
137
- tourKey = { EXPLORE_SPANS_TOUR_GUIDE_KEY }
138
- isCompleted = { isTourCompleted }
139
- orderedStepIds = { ORDERED_EXPLORE_SPANS_TOUR }
140
- TourContext = { ExploreSpansTourContext }
141
- >
142
- { children }
143
- </ TourContextProvider >
144
- ) ;
145
- }
146
-
147
- interface ActionsButtonProps {
148
- organization : Organization ;
149
- }
150
-
151
- function ActionsButton ( { organization} : ActionsButtonProps ) {
152
- const { startTour, isRegistered} = useExploreSpansTour ( ) ;
153
- const openForm = useFeedbackForm ( ) ;
154
-
155
- const location = useLocation ( ) ;
156
- const navigate = useNavigate ( ) ;
157
- const switchToOldTraceExplorer = useCallback ( ( ) => {
158
- navigate ( {
159
- ...location ,
160
- query : {
161
- ...location . query ,
162
- view : 'trace' ,
163
- } ,
164
- } ) ;
165
- } , [ location , navigate ] ) ;
166
-
167
- const items = [
168
- {
169
- key : 'take-tour' ,
170
- label : t ( 'Take a tour' ) ,
171
- hidden : ! isRegistered ,
172
- onAction : ( ) => {
173
- trackAnalytics ( 'explore.spans.tour.started' , { organization, method : 'dropdown' } ) ;
174
- startTour ( ) ;
175
- } ,
176
- } ,
177
- {
178
- key : 'give-feedback' ,
179
- label : t ( 'Give feedback on the UI' ) ,
180
- hidden : ! openForm ,
181
- onAction : ( ) => {
182
- openForm ?.( {
183
- messagePlaceholder : t ( 'Tell us what you think about the new UI' ) ,
184
- tags : {
185
- [ 'feedback.source' ] : 'explore.spans' ,
186
- [ 'feedback.owner' ] : 'explore' ,
187
- } ,
188
- } ) ;
189
- } ,
190
- } ,
191
- {
192
- key : 'switch-to-old-ui' ,
193
- label : t ( 'Switch to old trace explore' ) ,
194
- hidden : ! organization . features . includes ( 'visibility-explore-admin' ) ,
195
- onAction : switchToOldTraceExplorer ,
196
- } ,
197
- ] ;
198
-
199
- return (
200
- < DropdownMenu
201
- trigger = { triggerProps => (
202
- < StyledDropdownButton
203
- { ...triggerProps }
204
- size = "sm"
205
- aria-label = { t ( 'See Explore Spans Actions' ) }
206
- >
207
- < IconMegaphone />
208
- </ StyledDropdownButton >
209
- ) }
210
- items = { items }
211
- position = "bottom-end"
212
- />
213
- ) ;
214
- }
215
-
216
- const StyledDropdownButton = styled ( DropdownButton ) `
217
- color: ${ p => p . theme . button . primary . background } ;
218
- :hover {
219
- color: ${ p => p . theme . button . primary . background } ;
220
- }
221
- ` ;
0 commit comments