Skip to content

Commit a1ee381

Browse files
authored
ref(nav-v2): removes nav v2 flag (#95955)
Nav V2 is GAed and available for everyone (see [automator](https://github.com/getsentry/sentry-options-automator/blob/507cffc82679fc5aee370808a4b084dc6a416d27/options/default/flagpole.yml#L3538)), so we don't need the flag. Follow up to #95951.
1 parent a1c5287 commit a1ee381

File tree

5 files changed

+49
-61
lines changed

5 files changed

+49
-61
lines changed

static/app/components/performanceOnboarding/sidebar.spec.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ describe('Sidebar > Performance Onboarding Checklist', function () {
6161
body: [broadcast],
6262
});
6363

64+
MockApiClient.addMockResponse({
65+
url: `/organizations/${organization.slug}/prompts-activity/`,
66+
body: {data: null},
67+
});
68+
6469
MockApiClient.addMockResponse({
6570
url: `/organizations/${organization.slug}/onboarding-tasks/`,
6671
method: 'GET',

static/app/components/sidebar/help.tsx

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -98,21 +98,19 @@ function SidebarHelp({orientation, collapsed, hidePanel, organization}: Props) {
9898
{t('Give Feedback')}
9999
</SidebarMenuItem>
100100
) : null}
101-
{organization?.features?.includes('navigation-sidebar-v2') && (
102-
<SidebarMenuItem
103-
onClick={() => {
104-
mutateUserOptions({prefersStackedNavigation: true});
105-
trackAnalytics(
106-
'navigation.help_menu_opt_in_stacked_navigation_clicked',
107-
{
108-
organization,
109-
}
110-
);
111-
}}
112-
>
113-
{t('Try New Navigation')} <FeatureBadge type="new" />
114-
</SidebarMenuItem>
115-
)}
101+
<SidebarMenuItem
102+
onClick={() => {
103+
mutateUserOptions({prefersStackedNavigation: true});
104+
trackAnalytics(
105+
'navigation.help_menu_opt_in_stacked_navigation_clicked',
106+
{
107+
organization,
108+
}
109+
);
110+
}}
111+
>
112+
{t('Try New Navigation')} <FeatureBadge type="new" />
113+
</SidebarMenuItem>
116114
{organization?.features?.includes('chonk-ui') ? (
117115
user.options.prefersChonkUI ? (
118116
<SidebarMenuItem

static/app/components/sidebar/index.spec.tsx

Lines changed: 24 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@ import {OrganizationFixture} from 'sentry-fixture/organization';
55
import {ServiceIncidentFixture} from 'sentry-fixture/serviceIncident';
66
import {UserFixture} from 'sentry-fixture/user';
77

8-
import {act, render, screen, userEvent, waitFor} from 'sentry-test/reactTestingLibrary';
8+
import {
9+
act,
10+
render,
11+
screen,
12+
userEvent,
13+
waitFor,
14+
within,
15+
} from 'sentry-test/reactTestingLibrary';
916

1017
import {logout} from 'sentry/actionCreators/account';
1118
import {OnboardingContextProvider} from 'sentry/components/onboarding/onboardingContext';
@@ -91,6 +98,10 @@ describe('Sidebar', function () {
9198
method: 'GET',
9299
body: {onboardingTasks: []},
93100
});
101+
MockApiClient.addMockResponse({
102+
url: `/organizations/${organization.slug}/prompts-activity/`,
103+
body: {data: null},
104+
});
94105
});
95106

96107
afterEach(function () {
@@ -412,23 +423,13 @@ describe('Sidebar', function () {
412423
});
413424

414425
it('should render the sidebar banner with no dismissed prompts and the feature flag enabled', async () => {
415-
MockApiClient.addMockResponse({
416-
url: `/organizations/${organization.slug}/prompts-activity/`,
417-
body: {data: null},
418-
});
419-
420-
renderSidebarWithFeatures(['navigation-sidebar-v2']);
426+
renderSidebar({organization});
421427

422428
expect(await screen.findByText(/New Navigation/)).toBeInTheDocument();
423429
});
424430

425431
it('will not render sidebar banner when collapsed', async () => {
426-
MockApiClient.addMockResponse({
427-
url: `/organizations/${organization.slug}/prompts-activity/`,
428-
body: {data: null},
429-
});
430-
431-
renderSidebarWithFeatures(['navigation-sidebar-v2']);
432+
renderSidebar({organization});
432433

433434
await userEvent.click(screen.getByTestId('sidebar-collapse'));
434435

@@ -438,18 +439,13 @@ describe('Sidebar', function () {
438439
});
439440

440441
it('should show dot on help menu after dismissing sidebar banner', async () => {
441-
MockApiClient.addMockResponse({
442-
url: `/organizations/${organization.slug}/prompts-activity/`,
443-
body: {data: null},
444-
});
445-
446442
const dismissMock = MockApiClient.addMockResponse({
447443
url: `/organizations/${organization.slug}/prompts-activity/`,
448444
method: 'PUT',
449445
body: {},
450446
});
451447

452-
renderSidebarWithFeatures(['navigation-sidebar-v2']);
448+
renderSidebar({organization});
453449

454450
await userEvent.click(await screen.findByRole('button', {name: /Dismiss/}));
455451

@@ -480,11 +476,6 @@ describe('Sidebar', function () {
480476
options: {...user.options, prefersChonkUI: true},
481477
});
482478

483-
MockApiClient.addMockResponse({
484-
url: `/organizations/${organization.slug}/prompts-activity/`,
485-
body: {data: null},
486-
});
487-
488479
renderSidebarWithFeatures(['chonk-ui']);
489480
expect(screen.queryByText(/Sentry has a new look/)).not.toBeInTheDocument();
490481
});
@@ -528,11 +519,6 @@ describe('Sidebar', function () {
528519
options: {...user.options, prefersChonkUI: false},
529520
});
530521

531-
MockApiClient.addMockResponse({
532-
url: `/organizations/${organization.slug}/prompts-activity/`,
533-
body: {data: null},
534-
});
535-
536522
const dismiss = MockApiClient.addMockResponse({
537523
url: `/organizations/${organization.slug}/prompts-activity/`,
538524
method: 'PUT',
@@ -591,11 +577,6 @@ describe('Sidebar', function () {
591577
options: {...user.options, prefersChonkUI: false},
592578
});
593579

594-
MockApiClient.addMockResponse({
595-
url: `/organizations/${organization.slug}/prompts-activity/`,
596-
body: {data: null},
597-
});
598-
599580
const dismiss = MockApiClient.addMockResponse({
600581
url: `/organizations/${organization.slug}/prompts-activity/`,
601582
method: 'PUT',
@@ -610,8 +591,15 @@ describe('Sidebar', function () {
610591

611592
// The dot is not visible initially - banner takes precedence
612593
expect(screen.queryByTestId('help-menu-dot')).not.toBeInTheDocument();
613-
expect(await screen.findByText(/Sentry has a new look/)).toBeInTheDocument();
614-
await userEvent.click(screen.getByRole('button', {name: /Dismiss/}));
594+
const chonkBanner = await screen.findByText(/Sentry has a new look/);
595+
expect(chonkBanner).toBeInTheDocument();
596+
597+
// Find the dismiss button within the chonk UI banner
598+
await userEvent.click(
599+
within(screen.getByRole('complementary')).getByRole('button', {
600+
name: /Dismiss/,
601+
})
602+
);
615603

616604
expect(optionsRequest).not.toHaveBeenCalled();
617605
expect(dismiss).toHaveBeenCalledWith(

static/app/utils/theme/ChonkOptInBanner.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {useId} from 'react';
12
import type {Theme} from '@emotion/react';
23
import {ThemeProvider} from '@emotion/react';
34
import styled from '@emotion/styled';
@@ -18,17 +19,20 @@ export function ChonkOptInBanner(props: {collapsed: boolean | 'never'}) {
1819
const chonkPrompt = useChonkPrompt();
1920
const config = useLegacyStore(ConfigStore);
2021
const {mutate: mutateUserOptions} = useMutateUserOptions();
22+
const id = useId();
2123

2224
if (props.collapsed === true || !chonkPrompt.showbannerPrompt) {
2325
return null;
2426
}
2527

2628
return (
2729
<TranslucentBackgroundPanel
30+
role="complementary"
31+
aria-labelledby={id}
2832
isDarkMode={config.theme === 'dark'}
2933
position={props.collapsed === 'never' ? 'absolute' : 'relative'}
3034
>
31-
<Title>{t('Sentry has a new look')}</Title>
35+
<Title id={id}>{t('Sentry has a new look')}</Title>
3236
<Description>
3337
{t(`We've updated Sentry with a fresh new look, try it out by opting in below.`)}
3438
</Description>

static/app/views/nav/useNavPrompts.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,12 @@ export function useNavPrompts({
88
collapsed: boolean;
99
organization: Organization | null;
1010
}) {
11-
const hasNavigationV2Banner = organization?.features.includes('navigation-sidebar-v2');
12-
1311
const {
1412
isPromptDismissed: isSidebarPromptDismissed,
1513
dismissPrompt: dismissSidebarPrompt,
1614
} = usePrompt({
1715
feature: 'stacked_navigation_banner',
1816
organization,
19-
options: {enabled: hasNavigationV2Banner},
2017
});
2118

2219
const {
@@ -25,17 +22,13 @@ export function useNavPrompts({
2522
} = usePrompt({
2623
feature: 'stacked_navigation_help_menu',
2724
organization,
28-
options: {enabled: hasNavigationV2Banner},
2925
});
3026

3127
const shouldShowHelpMenuDot =
32-
hasNavigationV2Banner &&
33-
isDropdownPromptDismissed === false &&
34-
(collapsed || isSidebarPromptDismissed);
28+
isDropdownPromptDismissed === false && (collapsed || isSidebarPromptDismissed);
3529

3630
return {
37-
shouldShowSidebarBanner:
38-
hasNavigationV2Banner && !collapsed && isSidebarPromptDismissed === false,
31+
shouldShowSidebarBanner: !collapsed && isSidebarPromptDismissed === false,
3932
shouldShowHelpMenuDot,
4033
onOpenHelpMenu: () => {
4134
if (shouldShowHelpMenuDot) {

0 commit comments

Comments
 (0)