Skip to content

Commit 3b9baab

Browse files
fix(replays): fix placement of mobile banner (#82936)
## AFTER: under ff (is a beta org) and proj is mobile replay platform: <img width="1181" alt="SCR-20250106-jexg" src="https://github.com/user-attachments/assets/aadea33f-99e0-4383-9cbe-1d050aaccbe4" /> under ff but proj is not a replay mobile platform: <img width="1186" alt="SCR-20250106-jewc" src="https://github.com/user-attachments/assets/30285401-194a-4bef-bbef-41e7f45df732" /> ## BEFORE: under ff (is a beta org) and proj is mobile replay platform: <img width="1184" alt="SCR-20250106-jfpb" src="https://github.com/user-attachments/assets/8df07232-8a2a-49f1-9ea4-f61139916223" /> under ff but proj is not a replay mobile platform: <img width="1178" alt="SCR-20250106-jfqf" src="https://github.com/user-attachments/assets/75d5693e-8f24-40d1-a110-4ccd044f1a58" />
1 parent 22d79a3 commit 3b9baab

File tree

9 files changed

+44
-38
lines changed

9 files changed

+44
-38
lines changed

static/app/components/replays/alerts/replayUnsupportedAlert.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import styled from '@emotion/styled';
2+
13
import Alert from 'sentry/components/alert';
24
import ExternalLink from 'sentry/components/links/externalLink';
35
import {IconInfo} from 'sentry/icons';
@@ -12,11 +14,15 @@ export default function ReplayUnsupportedAlert({projectSlug}: Props) {
1214
<ExternalLink href="https://docs.sentry.io/product/session-replay/getting-started/#supported-sdks" />
1315
);
1416
return (
15-
<Alert icon={<IconInfo />}>
17+
<StyledAlert icon={<IconInfo />}>
1618
<strong>{t(`Session Replay isn't available for %s.`, projectSlug)}</strong>{' '}
1719
{tct(`[docsLink: See our docs] to find out which platforms are supported.`, {
1820
docsLink,
1921
})}
20-
</Alert>
22+
</StyledAlert>
2123
);
2224
}
25+
26+
const StyledAlert = styled(Alert)`
27+
margin: 0;
28+
`;

static/app/views/issueDetails/groupReplays/groupReplays.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function GroupReplays({group}: Props) {
6464
location,
6565
organization,
6666
});
67-
const {allMobileProj} = useAllMobileProj();
67+
const {allMobileProj} = useAllMobileProj({});
6868

6969
useEffect(() => {
7070
trackAnalytics('replay.render-issues-group-list', {
@@ -137,7 +137,7 @@ function GroupReplaysTableInner({
137137
replaySlug,
138138
group,
139139
});
140-
const {allMobileProj} = useAllMobileProj();
140+
const {allMobileProj} = useAllMobileProj({});
141141

142142
return (
143143
<ReplayContextProvider
@@ -189,7 +189,7 @@ function GroupReplaysTable({
189189
queryReferrer: 'issueReplays',
190190
});
191191
const {replays} = replayListData;
192-
const {allMobileProj} = useAllMobileProj();
192+
const {allMobileProj} = useAllMobileProj({});
193193

194194
const rawReplayIndex = urlParams.getParamValue('selected_replay_index');
195195
const selectedReplayIndex = parseInt(

static/app/views/performance/transactionSummary/transactionReplays/transactionReplays.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ function ReplaysContent({
162162
events,
163163
});
164164

165-
const {allMobileProj} = useAllMobileProj();
165+
const {allMobileProj} = useAllMobileProj({});
166166

167167
return (
168168
<Layout.Main fullWidth>
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import {mobile} from 'sentry/data/platformCategories';
1+
import {mobile, replayMobilePlatforms} from 'sentry/data/platformCategories';
22
import usePageFilters from 'sentry/utils/usePageFilters';
33
import useProjects from 'sentry/utils/useProjects';
44

5-
export default function useAllMobileProj() {
5+
export default function useAllMobileProj({replayPlatforms}: {replayPlatforms?: boolean}) {
66
const {
77
selection: {projects: projectIds},
88
} = usePageFilters();
@@ -13,7 +13,9 @@ export default function useAllMobileProj() {
1313
// if no projects selected, look through all projects
1414
const proj = projectsSelected.length ? projectsSelected : projects;
1515

16-
const allMobileProj = proj.every(p => mobile.includes(p.platform ?? 'other'));
16+
const allMobileProj = replayPlatforms
17+
? proj.every(p => replayMobilePlatforms.includes(p.platform ?? 'other'))
18+
: proj.every(p => mobile.includes(p.platform ?? 'other'));
1719

1820
return {allMobileProj};
1921
}

static/app/views/replays/list.tsx

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
import {Fragment} from 'react';
22
import styled from '@emotion/styled';
33

4-
import Alert from 'sentry/components/alert';
54
import HookOrDefault from 'sentry/components/hookOrDefault';
65
import * as Layout from 'sentry/components/layouts/thirds';
7-
import ExternalLink from 'sentry/components/links/externalLink';
86
import PageFiltersContainer from 'sentry/components/organizations/pageFilters/container';
97
import {PageHeadingQuestionTooltip} from 'sentry/components/pageHeadingQuestionTooltip';
108
import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
11-
import {IconInfo} from 'sentry/icons';
12-
import {t, tct} from 'sentry/locale';
9+
import {t} from 'sentry/locale';
1310
import {space} from 'sentry/styles/space';
1411
import useReplayPageview from 'sentry/utils/replays/hooks/useReplayPageview';
1512
import useOrganization from 'sentry/utils/useOrganization';
16-
import useAllMobileProj from 'sentry/views/replays/detail/useAllMobileProj';
1713
import ListContent from 'sentry/views/replays/list/listContent';
1814
import ReplayTabs from 'sentry/views/replays/tabs';
1915

@@ -25,8 +21,6 @@ const ReplayListPageHeaderHook = HookOrDefault({
2521
function ReplaysListContainer() {
2622
useReplayPageview('replay.list-time-spent');
2723
const organization = useOrganization();
28-
const {allMobileProj} = useAllMobileProj();
29-
const mobileBetaOrg = organization.features.includes('mobile-replay-beta-orgs');
3024

3125
return (
3226
<SentryDocumentTitle title={`Session Replay — ${organization.slug}`}>
@@ -50,19 +44,6 @@ function ReplaysListContainer() {
5044
<Layout.Main fullWidth>
5145
<LayoutGap>
5246
<ReplayListPageHeaderHook />
53-
{allMobileProj && mobileBetaOrg ? (
54-
<StyledAlert icon={<IconInfo />} showIcon>
55-
{tct(
56-
`[strong:Mobile Replay is now generally available.] Since you participated in the beta, will have a two month grace period of free usage, until March 6. After that, you will be billed for [link:additional replays not included in your plan].`,
57-
{
58-
strong: <strong />,
59-
link: (
60-
<ExternalLink href="https://docs.sentry.io/pricing/#replays-pricing" />
61-
),
62-
}
63-
)}
64-
</StyledAlert>
65-
) : null}
6647
<ListContent />
6748
</LayoutGap>
6849
</Layout.Main>
@@ -77,8 +58,4 @@ const LayoutGap = styled('div')`
7758
gap: ${space(2)};
7859
`;
7960

80-
const StyledAlert = styled(Alert)`
81-
margin: 0;
82-
`;
83-
8461
export default ReplaysListContainer;

static/app/views/replays/list/listContent.tsx

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
import {Fragment, useState} from 'react';
22
import styled from '@emotion/styled';
33

4+
import Alert from 'sentry/components/alert';
45
import {Button} from 'sentry/components/button';
6+
import ExternalLink from 'sentry/components/links/externalLink';
57
import LoadingIndicator from 'sentry/components/loadingIndicator';
68
import ReplayRageClickSdkVersionBanner from 'sentry/components/replays/replayRageClickSdkVersionBanner';
7-
import {t} from 'sentry/locale';
9+
import {IconInfo} from 'sentry/icons';
10+
import {t, tct} from 'sentry/locale';
811
import {space} from 'sentry/styles/space';
912
import {useHaveSelectedProjectsSentAnyReplayEvents} from 'sentry/utils/replays/hooks/useReplayOnboarding';
1013
import {MIN_DEAD_RAGE_CLICK_SDK} from 'sentry/utils/replays/sdkVersions';
@@ -33,7 +36,8 @@ export default function ListContent() {
3336
projectId: projects.map(String),
3437
});
3538

36-
const {allMobileProj} = useAllMobileProj();
39+
const {allMobileProj} = useAllMobileProj({replayPlatforms: true});
40+
const mobileBetaOrg = organization.features.includes('mobile-replay-beta-orgs');
3741

3842
const [widgetIsOpen, setWidgetIsOpen] = useState(true);
3943

@@ -62,6 +66,19 @@ export default function ListContent() {
6266
<ReplaysFilters />
6367
<ReplaysSearch />
6468
</FiltersContainer>
69+
{allMobileProj && mobileBetaOrg ? (
70+
<StyledAlert icon={<IconInfo />} showIcon>
71+
{tct(
72+
`[strong:Mobile Replay is now generally available.] Orgs that participated in the beta will have a two month grace period of unlimited usage until March 6. After that, you will be billed for [link:additional replays not included in your plan].`,
73+
{
74+
strong: <strong />,
75+
link: (
76+
<ExternalLink href="https://docs.sentry.io/pricing/#replays-pricing" />
77+
),
78+
}
79+
)}
80+
</StyledAlert>
81+
) : null}
6582
<ReplayOnboardingPanel />
6683
</Fragment>
6784
);
@@ -110,3 +127,7 @@ const SearchWrapper = styled(FiltersContainer)`
110127
flex-grow: 1;
111128
flex-wrap: nowrap;
112129
`;
130+
131+
const StyledAlert = styled(Alert)`
132+
margin: 0;
133+
`;

static/app/views/replays/list/replayOnboardingPanel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ export function SetupReplaysCTA({
122122
}: SetupReplaysCTAProps) {
123123
const {activateSidebar} = useReplayOnboardingSidebarPanel();
124124
const [expanded, setExpanded] = useState(-1);
125-
const {allMobileProj} = useAllMobileProj();
125+
const {allMobileProj} = useAllMobileProj({});
126126

127127
const FAQ = [
128128
{

static/app/views/replays/list/replaysList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function ReplaysList() {
5252
selection: {projects},
5353
} = usePageFilters();
5454

55-
const {allMobileProj} = useAllMobileProj();
55+
const {allMobileProj} = useAllMobileProj({});
5656

5757
const {needsUpdate: allSelectedProjectsNeedUpdates} = useProjectSdkNeedsUpdate({
5858
minVersion: MIN_REPLAY_CLICK_SDK,

static/app/views/replays/tabs.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ interface Props {
1414
export default function ReplayTabs({selected}: Props) {
1515
const organization = useOrganization();
1616
const location = useLocation();
17-
const {allMobileProj} = useAllMobileProj();
17+
const {allMobileProj} = useAllMobileProj({});
1818

1919
const tabs = useMemo(
2020
() => [

0 commit comments

Comments
 (0)