Skip to content

Commit b4cf046

Browse files
authored
ref(tags/flags): exclude flags from button label for unsupported platforms (#89430)
Follow up to #88691. Changes the label of this button/link to just "View all tags" if platform is unsupported. We don't show the drawer's segmented control in these platforms so best to avoid confusion ![Screenshot 2025-04-11 at 1 31 48 PM](https://github.com/user-attachments/assets/75930a58-1b53-440b-8288-7baa4a38ff95) Also renames `IssueTagButton` components to `DistributionsDrawerButton`, now the tags drawer + route is distributions.
1 parent cfeaa0f commit b4cf046

File tree

1 file changed

+26
-15
lines changed

1 file changed

+26
-15
lines changed

static/app/views/issueDetails/streamline/issueTagsPreview.tsx

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ import Link from 'sentry/components/links/link';
1010
import Placeholder from 'sentry/components/placeholder';
1111
import TextOverflow from 'sentry/components/textOverflow';
1212
import {Tooltip} from 'sentry/components/tooltip';
13-
import {backend, frontend} from 'sentry/data/platformCategories';
13+
import {
14+
backend,
15+
featureFlagDrawerPlatforms,
16+
frontend,
17+
} from 'sentry/data/platformCategories';
1418
import {t, tct} from 'sentry/locale';
1519
import {space} from 'sentry/styles/space';
1620
import type {Project} from 'sentry/types/project';
@@ -159,25 +163,24 @@ function TagPreviewProgressBar({tag, groupId}: {groupId: string; tag: GroupTag})
159163
);
160164
}
161165

162-
function IssueTagButton({
166+
function DistributionsDrawerButton({
163167
tags,
168+
includeFeatureFlags,
164169
searchQuery,
165170
isScreenSmall,
166171
}: {
172+
includeFeatureFlags: boolean;
167173
tags: GroupTag[];
168174
isScreenSmall?: boolean;
169175
searchQuery?: string;
170176
}) {
171177
const {baseUrl} = useGroupDetailsRoute();
172178
const location = useLocation();
173179
const organization = useOrganization();
174-
const hasFlagsDistributions = organization.features.includes(
175-
'feature-flag-distribution-flyout'
176-
);
177180

178181
if (tags.length === 0 || searchQuery || isScreenSmall) {
179182
return (
180-
<VerticalIssueTagsButton
183+
<VerticalDistributionsDrawerButton
181184
aria-label={t('View issue tag distributions')}
182185
size="xs"
183186
to={{
@@ -187,19 +190,19 @@ function IssueTagButton({
187190
replace
188191
disabled={tags.length === 0}
189192
>
190-
{hasFlagsDistributions
193+
{includeFeatureFlags
191194
? tct('View[nbsp]All Tags[nbsp]&[nbsp]Flags', {
192195
nbsp: '\u00A0', // non-breaking space unicode character.
193196
})
194197
: tct('View All[nbsp]Tags', {
195198
nbsp: '\u00A0', // non-breaking space unicode character.
196199
})}
197-
</VerticalIssueTagsButton>
200+
</VerticalDistributionsDrawerButton>
198201
);
199202
}
200203

201204
return (
202-
<IssueTagsLink
205+
<DistributionsDrawerLink
203206
to={{
204207
pathname: `${baseUrl}${TabPaths[Tab.DISTRIBUTIONS]}`,
205208
query: location.query,
@@ -208,8 +211,8 @@ function IssueTagButton({
208211
trackAnalytics('issue_details.issue_tags_click', {organization});
209212
}}
210213
>
211-
{hasFlagsDistributions ? t('View all tags and feature flags') : t('View all tags')}
212-
</IssueTagsLink>
214+
{includeFeatureFlags ? t('View all tags and feature flags') : t('View all tags')}
215+
</DistributionsDrawerLink>
213216
);
214217
}
215218

@@ -275,16 +278,21 @@ export default function IssueTagsPreview({
275278
return uniqueTags.slice(0, 4);
276279
}, [tags, project.platform, highlightTagKeys]);
277280

281+
const includeFeatureFlags =
282+
featureFlagDrawerPlatforms.includes(project.platform ?? 'other') &&
283+
organization.features.includes('feature-flag-distribution-flyout');
284+
278285
if (
279286
searchQuery ||
280287
isScreenSmall ||
281288
(!isPending && !isHighlightPending && tagsToPreview.length === 0)
282289
) {
283290
return (
284-
<IssueTagButton
291+
<DistributionsDrawerButton
285292
tags={tagsToPreview}
286293
searchQuery={searchQuery}
287294
isScreenSmall={isScreenSmall}
295+
includeFeatureFlags={includeFeatureFlags}
288296
/>
289297
);
290298
}
@@ -313,7 +321,10 @@ export default function IssueTagsPreview({
313321
<TagPreviewProgressBar key={tag.key} tag={tag} groupId={groupId} />
314322
))}
315323
</TagsPreview>
316-
<IssueTagButton tags={tagsToPreview} />
324+
<DistributionsDrawerButton
325+
tags={tagsToPreview}
326+
includeFeatureFlags={includeFeatureFlags}
327+
/>
317328
</IssueTagPreviewSection>
318329
</Fragment>
319330
);
@@ -422,7 +433,7 @@ const LegendTitle = styled('div')`
422433
margin-bottom: ${space(0.75)};
423434
`;
424435

425-
const IssueTagsLink = styled(Link)`
436+
const DistributionsDrawerLink = styled(Link)`
426437
color: ${p => p.theme.purple300};
427438
align-self: flex-start;
428439
@@ -431,7 +442,7 @@ const IssueTagsLink = styled(Link)`
431442
}
432443
`;
433444

434-
const VerticalIssueTagsButton = styled(LinkButton)`
445+
const VerticalDistributionsDrawerButton = styled(LinkButton)`
435446
display: block;
436447
flex: 0;
437448
margin: ${space(1)} ${space(2)} ${space(1)} ${space(1)};

0 commit comments

Comments
 (0)