Skip to content

Commit 13910c8

Browse files
authored
Revert "feat(explore): Add tour for explore spans" (#89463)
Reverts #89248 temporarily due to interference with the left-nav tour https://sentry.slack.com/archives/C07FYJX72E5/p1744475783725279
1 parent b4cf046 commit 13910c8

File tree

5 files changed

+131
-480
lines changed

5 files changed

+131
-480
lines changed

static/app/components/tours/components.tsx

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import type {CSSProperties, HTMLAttributes} from 'react';
2-
import {Fragment, useContext, useEffect, useMemo} from 'react';
1+
import {Fragment, type HTMLAttributes, useContext, useEffect, useMemo} from 'react';
32
import {createPortal} from 'react-dom';
43
import {ClassNames, useTheme} from '@emotion/react';
54
import styled from '@emotion/styled';
@@ -184,7 +183,6 @@ export interface TourElementProps<T extends TourEnumType>
184183
* The actions to display in the tour element.
185184
*/
186185
actions?: React.ReactNode;
187-
margin?: number;
188186
/**
189187
* The position of the tour element.
190188
*/
@@ -221,7 +219,6 @@ export function TourElementContent<T extends TourEnumType>({
221219
position,
222220
className,
223221
actions,
224-
margin,
225222
}: TourElementContentProps<T>) {
226223
const organization = useOrganization();
227224
const {
@@ -318,7 +315,6 @@ export function TourElementContent<T extends TourEnumType>({
318315
stepCount={stepCount}
319316
stepTotal={stepTotal}
320317
id={`${id}`}
321-
margin={margin}
322318
>
323319
{children}
324320
</TourGuide>
@@ -337,13 +333,17 @@ interface TourGuideProps extends Omit<HTMLAttributes<HTMLElement>, 'title' | 'id
337333
actions?: React.ReactNode;
338334
handleDismiss?: (e: React.MouseEvent) => void;
339335
id?: string;
340-
margin?: CSSProperties['margin'];
341336
offset?: UseOverlayProps['offset'];
342337
position?: UseOverlayProps['position'];
343338
stepCount?: number;
344339
stepTotal?: number;
345340
title?: React.ReactNode;
346-
wrapperComponent?: React.ElementType;
341+
wrapperComponent?: React.ComponentType<{
342+
'aria-expanded': React.AriaAttributes['aria-expanded'];
343+
children: React.ReactNode;
344+
ref: React.RefAttributes<HTMLElement>['ref'];
345+
prefersDarkMode?: boolean;
346+
}>;
347347
}
348348

349349
export function TourGuide({
@@ -359,7 +359,6 @@ export function TourGuide({
359359
wrapperComponent,
360360
stepTotal,
361361
offset,
362-
margin,
363362
}: TourGuideProps) {
364363
const config = useLegacyStore(ConfigStore);
365364
const prefersDarkMode = config.theme === 'dark';
@@ -391,7 +390,7 @@ export function TourGuide({
391390
className={className}
392391
ref={triggerProps.ref}
393392
aria-expanded={triggerProps['aria-expanded']}
394-
margin={`${margin}px`}
393+
prefersDarkMode={prefersDarkMode}
395394
>
396395
{children}
397396
</Wrapper>
@@ -547,7 +546,7 @@ const BlurWindow = styled('div')`
547546
backdrop-filter: blur(3px);
548547
`;
549548

550-
export const TourTriggerWrapper = styled('div')<{margin?: CSSProperties['margin']}>`
549+
const TourTriggerWrapper = styled('div')<{prefersDarkMode: boolean}>`
551550
&[aria-expanded='true'] {
552551
position: relative;
553552
z-index: ${p => p.theme.zIndex.tour.element};
@@ -561,7 +560,6 @@ export const TourTriggerWrapper = styled('div')<{margin?: CSSProperties['margin'
561560
inset: 0;
562561
border-radius: ${p => p.theme.borderRadius};
563562
box-shadow: inset 0 0 0 3px ${p => p.theme.tour.background};
564-
margin: ${p => p.margin};
565563
}
566564
}
567565
`;

static/app/views/explore/content.tsx

Lines changed: 19 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,49 @@
1-
import type {ReactNode} from 'react';
2-
import {useCallback, useMemo} from 'react';
3-
import styled from '@emotion/styled';
1+
import {useCallback} from 'react';
42

53
import Feature from 'sentry/components/acl/feature';
64
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';
86
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';
118
import * as Layout from 'sentry/components/layouts/thirds';
129
import PageFiltersContainer from 'sentry/components/organizations/pageFilters/container';
1310
import {PageHeadingQuestionTooltip} from 'sentry/components/pageHeadingQuestionTooltip';
1411
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';
1812
import {t} from 'sentry/locale';
19-
import type {Organization} from 'sentry/types/organization';
2013
import {defined} from 'sentry/utils';
21-
import {trackAnalytics} from 'sentry/utils/analytics';
22-
import {useFeedbackForm} from 'sentry/utils/useFeedbackForm';
2314
import {useLocation} from 'sentry/utils/useLocation';
2415
import {useNavigate} from 'sentry/utils/useNavigate';
2516
import useOrganization from 'sentry/utils/useOrganization';
2617
import ExploreBreadcrumb from 'sentry/views/explore/components/breadcrumb';
2718
import {getIdFromLocation} from 'sentry/views/explore/contexts/pageParamsContext/id';
2819
import {getTitleFromLocation} from 'sentry/views/explore/contexts/pageParamsContext/title';
2920
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';
3821
import {limitMaxPickableDays} from 'sentry/views/explore/utils';
3922
import {usePrefersStackedNav} from 'sentry/views/nav/prefersStackedNav';
4023

4124
export function ExploreContent() {
42-
return (
43-
<SpansTabTour>
44-
<ExploreContentImpl />
45-
</SpansTabTour>
46-
);
47-
}
48-
49-
function ExploreContentImpl() {
5025
const organization = useOrganization();
5126
const {defaultPeriod, maxPickableDays, relativeOptions} =
5227
limitMaxPickableDays(organization);
5328
const prefersStackedNav = usePrefersStackedNav();
5429

5530
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]);
5641

5742
const hasSavedQueries = organization.features.includes('performance-saved-queries');
5843

5944
const title = getTitleFromLocation(location);
6045
const id = getIdFromLocation(location);
6146

62-
useExploreSpansTourModal();
63-
6447
return (
6548
<SentryDocumentTitle title={t('Traces')} orgSlug={organization?.slug}>
6649
<PageFiltersContainer maxPickableDays={maxPickableDays}>
@@ -89,6 +72,11 @@ function ExploreContentImpl() {
8972
</Layout.HeaderContent>
9073
<Layout.HeaderActions>
9174
<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>
9280
{!prefersStackedNav && (
9381
<Feature
9482
organization={organization}
@@ -102,7 +90,7 @@ function ExploreContentImpl() {
10290
</LinkButton>
10391
</Feature>
10492
)}
105-
<ActionsButton organization={organization} />
93+
<FeedbackWidgetButton />
10694
</ButtonBar>
10795
</Layout.HeaderActions>
10896
</Layout.Header>
@@ -116,106 +104,3 @@ function ExploreContentImpl() {
116104
</SentryDocumentTitle>
117105
);
118106
}
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

Comments
 (0)