Skip to content

Commit 709f440

Browse files
authored
ref(feature flags): Extract HeaderTitle from GroupDistributionsDrawer (#89767)
1 parent 8abf2b1 commit 709f440

File tree

2 files changed

+42
-24
lines changed

2 files changed

+42
-24
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import styled from '@emotion/styled';
2+
3+
import {t, tct} from 'sentry/locale';
4+
import {DrawerTab} from 'sentry/views/issueDetails/groupDistributions/types';
5+
6+
export default function HeaderTitle({
7+
includeFeatureFlagsTab,
8+
tab,
9+
tagKey,
10+
}: {
11+
includeFeatureFlagsTab: boolean;
12+
tab: DrawerTab;
13+
tagKey: string | undefined;
14+
}) {
15+
if (tagKey) {
16+
return (
17+
<Header>
18+
{tab === DrawerTab.TAGS
19+
? tct('Tag Details - [tagKey]', {tagKey})
20+
: tct('Feature Flag Details - [tagKey]', {tagKey})}
21+
</Header>
22+
);
23+
}
24+
25+
return (
26+
<Header>{includeFeatureFlagsTab ? t('Tags & Feature Flags') : t('All Tags')}</Header>
27+
);
28+
}
29+
30+
const Header = styled('h3')`
31+
${p => p.theme.overflowEllipsis};
32+
font-size: ${p => p.theme.fontSizeExtraLarge};
33+
font-weight: ${p => p.theme.fontWeightBold};
34+
margin: 0;
35+
`;

static/app/views/issueDetails/groupDistributionsDrawer.tsx

+7-24
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import {useRef, useState} from 'react';
2-
import styled from '@emotion/styled';
32

43
import AnalyticsArea from 'sentry/components/analyticsArea';
54
import {ButtonBar} from 'sentry/components/core/button/buttonBar';
@@ -12,13 +11,14 @@ import {
1211
SearchInput,
1312
} from 'sentry/components/events/eventDrawer';
1413
import {IconSearch} from 'sentry/icons';
15-
import {t, tct} from 'sentry/locale';
14+
import {t} from 'sentry/locale';
1615
import type {Group} from 'sentry/types/group';
1716
import {trackAnalytics} from 'sentry/utils/analytics';
1817
import useOrganization from 'sentry/utils/useOrganization';
1918
import {useParams} from 'sentry/utils/useParams';
2019
import useProjects from 'sentry/utils/useProjects';
2120
import GroupDistributionCrumbs from 'sentry/views/issueDetails/groupDistributions/groupDistributionCrumbs';
21+
import HeaderTitle from 'sentry/views/issueDetails/groupDistributions/headerTitle';
2222
import TagExportDropdown from 'sentry/views/issueDetails/groupDistributions/tagExportDropdown';
2323
import TagFlagPicker from 'sentry/views/issueDetails/groupDistributions/tagFlagPicker';
2424
import {DrawerTab} from 'sentry/views/issueDetails/groupDistributions/types';
@@ -29,20 +29,6 @@ import {TagDetailsDrawerContent} from 'sentry/views/issueDetails/groupTags/tagDe
2929
import TagDrawerContent from 'sentry/views/issueDetails/groupTags/tagDrawerContent';
3030
import {useEnvironmentsFromUrl} from 'sentry/views/issueDetails/utils';
3131

32-
function getHeaderTitle(
33-
tagKey: string | undefined,
34-
tab: DrawerTab,
35-
includeFeatureFlagsTab: boolean
36-
) {
37-
if (tagKey) {
38-
return tab === DrawerTab.TAGS
39-
? tct('Tag Details - [tagKey]', {tagKey})
40-
: tct('Feature Flag Details - [tagKey]', {tagKey});
41-
}
42-
43-
return includeFeatureFlagsTab ? t('Tags & Feature Flags') : t('All Tags');
44-
}
45-
4632
/**
4733
* Shared tags and feature flags distributions drawer, used by streamlined issue details UI.
4834
*/
@@ -123,7 +109,11 @@ function BaseGroupDistributionsDrawer({
123109
<GroupDistributionCrumbs group={group} project={project} tab={tab} />
124110
</EventDrawerHeader>
125111
<EventNavigator>
126-
<Header>{getHeaderTitle(tagKey, tab, includeFeatureFlagsTab)}</Header>
112+
<HeaderTitle
113+
includeFeatureFlagsTab={includeFeatureFlagsTab}
114+
tab={tab}
115+
tagKey={tagKey}
116+
/>
127117
{headerActions}
128118
</EventNavigator>
129119
<EventDrawerBody>
@@ -154,10 +144,3 @@ function BaseGroupDistributionsDrawer({
154144
</EventDrawerContainer>
155145
);
156146
}
157-
158-
const Header = styled('h3')`
159-
${p => p.theme.overflowEllipsis};
160-
font-size: ${p => p.theme.fontSizeExtraLarge};
161-
font-weight: ${p => p.theme.fontWeightBold};
162-
margin: 0;
163-
`;

0 commit comments

Comments
 (0)