Skip to content

Commit 1e0810f

Browse files
ref(shared-views): Add feature flag check to prefersStackedNav checks (#90609)
Depends on #90603 adds a feature flag check to `prefersStackedNav` and `usePrefersStackedNav`. This requires all call-sites for `prefersStackedNav` to be updated to consume an organization object. Luckily, all call-sites already had an organization in their context already, so this was an easy change. NOTE: This flag also does not exist just yet. I will create and register it before merging this PR. --------- Co-authored-by: Athena Moghaddam <[email protected]>
1 parent 846ad47 commit 1e0810f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+96
-54
lines changed

static/app/types/user.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export interface User extends Omit<AvatarUser, 'options'> {
5454
prefersChonkUI: boolean;
5555
prefersIssueDetailsStreamlinedUI: boolean | null;
5656
prefersNextjsInsightsOverview: boolean;
57-
prefersStackedNavigation: boolean;
57+
prefersStackedNavigation: boolean | null;
5858
quickStartDisplay: QuickStartDisplay;
5959
stacktraceOrder: number;
6060
theme: 'system' | 'light' | 'dark';

static/app/utils/profiling/routes.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const LEGACY_PROFILING_BASE_PATHNAME = 'profiling';
1414
const PROFILING_BASE_PATHNAME = 'explore/profiling';
1515

1616
function generateProfilingRoute({organization}: {organization: Organization}): Path {
17-
if (prefersStackedNav()) {
17+
if (prefersStackedNav(organization)) {
1818
return `/organizations/${organization.slug}/${PROFILING_BASE_PATHNAME}/`;
1919
}
2020

@@ -30,7 +30,7 @@ export function generateProfileFlamechartRoute({
3030
profileId: Trace['id'];
3131
projectSlug: Project['slug'];
3232
}): string {
33-
if (prefersStackedNav()) {
33+
if (prefersStackedNav(organization)) {
3434
return `/organizations/${organization.slug}/${PROFILING_BASE_PATHNAME}/profile/${projectSlug}/${profileId}/flamegraph/`;
3535
}
3636

@@ -44,7 +44,7 @@ function generateContinuousProfileFlamechartRoute({
4444
organization: Organization;
4545
projectSlug: Project['slug'];
4646
}): string {
47-
if (prefersStackedNav()) {
47+
if (prefersStackedNav(organization)) {
4848
return `/organizations/${organization.slug}/${PROFILING_BASE_PATHNAME}/profile/${projectSlug}/flamegraph/`;
4949
}
5050

@@ -58,7 +58,7 @@ function generateProfileDifferentialFlamegraphRoute({
5858
organization: Organization;
5959
projectSlug: Project['slug'];
6060
}): string {
61-
if (prefersStackedNav()) {
61+
if (prefersStackedNav(organization)) {
6262
return `/organizations/${organization.slug}/${PROFILING_BASE_PATHNAME}/profile/${projectSlug}/differential-flamegraph/`;
6363
}
6464

static/app/views/admin/adminLayout.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import styled from '@emotion/styled';
33
import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
44
import {t} from 'sentry/locale';
55
import type {RouteComponentProps} from 'sentry/types/legacyReactRouter';
6+
import useOrganization from 'sentry/utils/useOrganization';
67
import {prefersStackedNav} from 'sentry/views/nav/prefersStackedNav';
78
import {BreadcrumbProvider} from 'sentry/views/settings/components/settingsBreadcrumb/context';
89
import SettingsLayout from 'sentry/views/settings/components/settingsLayout';
@@ -46,12 +47,16 @@ type Props = {
4647
} & RouteComponentProps;
4748

4849
function AdminLayout({children, ...props}: Props) {
50+
const organization = useOrganization();
51+
4952
return (
5053
<SentryDocumentTitle noSuffix title={t('Sentry Admin')}>
5154
<Page>
5255
<BreadcrumbProvider>
5356
<SettingsLayout
54-
renderNavigation={prefersStackedNav() ? undefined : AdminNavigation}
57+
renderNavigation={
58+
prefersStackedNav(organization) ? undefined : AdminNavigation
59+
}
5560
{...props}
5661
>
5762
{children}

static/app/views/alerts/pathnames.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export function makeAlertsPathname({
1313
path: '/' | `/${string}/`;
1414
}) {
1515
return normalizeUrl(
16-
prefersStackedNav()
16+
prefersStackedNav(organization)
1717
? `/organizations/${organization.slug}/${ALERTS_BASE_PATHNAME}${path}`
1818
: `/organizations/${organization.slug}/${LEGACY_ALERTS_BASE_PATHNAME}${path}`
1919
);

static/app/views/dashboards/manage/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ import {
4545
import DashboardTable from 'sentry/views/dashboards/manage/dashboardTable';
4646
import type {DashboardsLayout} from 'sentry/views/dashboards/manage/types';
4747
import type {DashboardDetails, DashboardListItem} from 'sentry/views/dashboards/types';
48-
import {usePrefersStackedNav} from 'sentry/views/nav/prefersStackedNav';
48+
import {usePrefersStackedNav} from 'sentry/views/nav/usePrefersStackedNav';
4949
import RouteError from 'sentry/views/routeError';
5050

5151
import DashboardGrid from './dashboardGrid';

static/app/views/dashboards/widgetBuilder/components/newWidgetBuilder.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ import {
5252
import {DashboardsMEPProvider} from 'sentry/views/dashboards/widgetCard/dashboardsMEPContext';
5353
import {SpanTagsProvider} from 'sentry/views/explore/contexts/spanTagsContext';
5454
import {useNavContext} from 'sentry/views/nav/context';
55-
import {usePrefersStackedNav} from 'sentry/views/nav/prefersStackedNav';
55+
import {usePrefersStackedNav} from 'sentry/views/nav/usePrefersStackedNav';
5656
import {MetricsDataSwitcher} from 'sentry/views/performance/landing/metricsDataSwitcher';
5757

5858
export interface ThresholdMetaState {

static/app/views/discover/pathnames.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export function makeDiscoverPathname({
1313
path: '/' | `/${string}/`;
1414
}) {
1515
return normalizeUrl(
16-
prefersStackedNav()
16+
prefersStackedNav(organization)
1717
? `/organizations/${organization.slug}/${DISCOVER_BASE_PATHNAME}${path}`
1818
: `/organizations/${organization.slug}/${LEGACY_DISCOVER_BASE_PATHNAME}${path}`
1919
);

static/app/views/explore/content.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import {
3535
import {useExploreSpansTour} from 'sentry/views/explore/spans/tour';
3636
import {StarSavedQueryButton} from 'sentry/views/explore/starSavedQueryButton';
3737
import {limitMaxPickableDays} from 'sentry/views/explore/utils';
38-
import {usePrefersStackedNav} from 'sentry/views/nav/prefersStackedNav';
38+
import {usePrefersStackedNav} from 'sentry/views/nav/usePrefersStackedNav';
3939

4040
export function ExploreContent() {
4141
return (

static/app/views/explore/logs/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {TraceItemAttributeProvider} from 'sentry/views/explore/contexts/traceIte
1414
import {LogsTabContent} from 'sentry/views/explore/logs/logsTab';
1515
import {logsPickableDays} from 'sentry/views/explore/logs/utils';
1616
import {TraceItemDataset} from 'sentry/views/explore/types';
17-
import {usePrefersStackedNav} from 'sentry/views/nav/prefersStackedNav';
17+
import {usePrefersStackedNav} from 'sentry/views/nav/usePrefersStackedNav';
1818

1919
function FeedbackButton() {
2020
const openForm = useFeedbackForm();

static/app/views/explore/multiQueryMode/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import useOrganization from 'sentry/utils/useOrganization';
1313
import {getTitleFromLocation} from 'sentry/views/explore/contexts/pageParamsContext/title';
1414
import {MultiQueryModeContent} from 'sentry/views/explore/multiQueryMode/content';
1515
import {StarSavedQueryButton} from 'sentry/views/explore/starSavedQueryButton';
16-
import {usePrefersStackedNav} from 'sentry/views/nav/prefersStackedNav';
16+
import {usePrefersStackedNav} from 'sentry/views/nav/usePrefersStackedNav';
1717
import {makeTracesPathname} from 'sentry/views/traces/pathnames';
1818

1919
export default function MultiQueryMode() {

0 commit comments

Comments
 (0)