Skip to content

Commit

Permalink
ref(insights): remove conditional that render module upsell (#81342)
Browse files Browse the repository at this point in the history
Before domain views were released, we conditionally rendered the module
upsells. If the domain views were not enabled we rendered full screen
module upsells, otherwise we rendered a body upsell (so that the
tabs/headers are retained).

Now that we GA'd domain views, we no longer need these conditions.

This PR also removes the `Feature` component in the
`ModuleBodyUpsellHook` component. Feature gating already handled in the
`ModulePageProviders`, so there's no reason to do it twice.
  • Loading branch information
DominikB2014 authored Nov 28, 2024
1 parent b96dfc5 commit 2f0fc12
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 62 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Feature from 'sentry/components/acl/feature';
import HookOrDefault from 'sentry/components/hookOrDefault';
import * as Layout from 'sentry/components/layouts/thirds';
import NoProjectMessage from 'sentry/components/noProjectMessage';
import PageFiltersContainer from 'sentry/components/organizations/pageFilters/container';
Expand All @@ -9,7 +8,6 @@ import useOrganization from 'sentry/utils/useOrganization';
import {NoAccess} from 'sentry/views/insights/common/components/noAccess';
import {useHasDataTrackAnalytics} from 'sentry/views/insights/common/utils/useHasDataTrackAnalytics';
import {useModuleTitles} from 'sentry/views/insights/common/utils/useModuleTitle';
import {useDomainViewFilters} from 'sentry/views/insights/pages/useFilters';
import {
INSIGHTS_TITLE,
MODULE_FEATURE_MAP,
Expand All @@ -35,7 +33,6 @@ export function ModulePageProviders({
}: Props) {
const organization = useOrganization();
const moduleTitles = useModuleTitles();
const {isInDomainView} = useDomainViewFilters();

const hasDateRangeQueryLimit = organization.features.includes(
'insights-query-date-range-limit'
Expand All @@ -46,7 +43,6 @@ export function ModulePageProviders({
useHasDataTrackAnalytics(moduleName as ModuleName, analyticEventName);

const moduleTitle = moduleTitles[moduleName];
const shouldUseUpsellHook = !isInDomainView;

const fullPageTitle = [pageTitle, moduleTitle, INSIGHTS_TITLE]
.filter(Boolean)
Expand All @@ -57,39 +53,16 @@ export function ModulePageProviders({
maxPickableDays={hasDateRangeQueryLimit ? QUERY_DATE_RANGE_LIMIT : undefined}
>
<SentryDocumentTitle title={fullPageTitle} orgSlug={organization.slug}>
{shouldUseUpsellHook && (
<UpsellPageHook moduleName={moduleName}>
<Layout.Page>
<Feature
features={features}
organization={organization}
renderDisabled={NoAccess}
>
<NoProjectMessage organization={organization}>
{children}
</NoProjectMessage>
</Feature>
</Layout.Page>
</UpsellPageHook>
)}

{!shouldUseUpsellHook && (
<Layout.Page>
<Feature
features={['insights-entry-points']}
organization={organization}
renderDisabled={NoAccess}
>
<NoProjectMessage organization={organization}>{children}</NoProjectMessage>
</Feature>
</Layout.Page>
)}
<Layout.Page>
<Feature
features={features}
organization={organization}
renderDisabled={NoAccess}
>
<NoProjectMessage organization={organization}>{children}</NoProjectMessage>
</Feature>
</Layout.Page>
</SentryDocumentTitle>
</PageFiltersContainer>
);
}

export const UpsellPageHook = HookOrDefault({
hookName: 'component:insights-upsell-page',
defaultComponent: ({children}) => children,
});
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
import Feature from 'sentry/components/acl/feature';
import {NoAccess} from 'sentry/components/noAccess';
import useOrganization from 'sentry/utils/useOrganization';
import {
type TitleableModuleNames,
UpsellPageHook,
} from 'sentry/views/insights/common/components/modulePageProviders';
import {useDomainViewFilters} from 'sentry/views/insights/pages/useFilters';
import {MODULE_FEATURE_MAP} from 'sentry/views/insights/settings';
import HookOrDefault from 'sentry/components/hookOrDefault';
import type {TitleableModuleNames} from 'sentry/views/insights/common/components/modulePageProviders';

// TODO - remove, This is only necessary for domain views, where we don't want to show the full upsell page.
export function ModuleBodyUpsellHook({
Expand All @@ -16,21 +9,14 @@ export function ModuleBodyUpsellHook({
children: React.ReactNode;
moduleName: TitleableModuleNames;
}) {
const {isInDomainView: shouldDisplayUpsell} = useDomainViewFilters();
const organization = useOrganization();

if (shouldDisplayUpsell) {
return (
<UpsellPageHook moduleName={moduleName} fullPage={false}>
<Feature
features={MODULE_FEATURE_MAP[moduleName]}
organization={organization}
renderDisabled={NoAccess}
>
{children}
</Feature>
</UpsellPageHook>
);
}
return children;
return (
<UpsellPageHook moduleName={moduleName} fullPage={false}>
{children}
</UpsellPageHook>
);
}

const UpsellPageHook = HookOrDefault({
hookName: 'component:insights-upsell-page',
defaultComponent: ({children}) => children,
});

0 comments on commit 2f0fc12

Please sign in to comment.