Skip to content

Commit 79d6f95

Browse files
ryan953andrewshie-sentry
authored andcommitted
fix(flags): Iterate on the Tags & Flags drawer styles (#91399)
This has a bunch of really small fixes in it, mostly related to resizing the Tags & Flags drawer. EventDrawerContainer now sizes it's content correctly. It's expected to have 3 items: `EventDrawerHeader, EventNavigator, EventDrawerBody` and space is not reserved for the top two items if the 3rd item extends beyond the height of the window. Before the title would easily be squished The empty state for the Feature Flags distribution drawer now hides the image when the drawer is narrow, and resizing the width doesn't affect the height of the message. The image is always stuck to the bottom of the box. We no longer show the Suspect Flags section if there are no flags at all on the issue. The same GradientBox is used as a container for all Suspect Flag states. Title is consistent too. Fixes #91288
1 parent 619686a commit 79d6f95

File tree

4 files changed

+62
-28
lines changed

4 files changed

+62
-28
lines changed

static/app/components/events/eventDrawer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export const ShortId = styled('div')`
3939
export const EventDrawerContainer = styled('div')`
4040
height: 100%;
4141
display: grid;
42-
grid-template-rows: auto auto 1fr;
42+
grid-template-rows: max-content max-content auto;
4343
`;
4444

4545
export const EventDrawerHeader = styled(DrawerHeader)`

static/app/components/events/featureFlags/cta/featureFlagInlineCTA.tsx

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export function FeatureFlagCTAContent({
6363
</LinkButton>
6464
</ActionButton>
6565
</BannerContent>
66-
<BannerIllustration src={onboardingInstall} alt={t('Install')} />
66+
<BannerIllustration src={onboardingInstall} alt="" />
6767
</Fragment>
6868
);
6969
}
@@ -194,19 +194,18 @@ const BannerContent = styled('div')`
194194
`;
195195

196196
const BannerIllustration = styled('img')`
197-
height: 100%;
198197
object-fit: contain;
199198
max-width: 30%;
200-
margin-right: 10px;
201-
margin-bottom: -${space(2)};
202-
padding: ${space(2)};
199+
min-width: 150px;
200+
padding-inline: ${space(2)};
201+
padding-top: ${space(2)};
202+
align-self: flex-end;
203203
`;
204204

205205
export const BannerWrapper = styled('div')`
206206
position: relative;
207207
border: 1px solid ${p => p.theme.border};
208208
border-radius: ${p => p.theme.borderRadius};
209-
margin: ${space(1)} 0;
210209
background: linear-gradient(
211210
90deg,
212211
${p => p.theme.backgroundSecondary}00 0%,
@@ -218,6 +217,15 @@ export const BannerWrapper = styled('div')`
218217
align-items: flex-end;
219218
justify-content: space-between;
220219
gap: ${space(1)};
220+
221+
container-name: bannerWrapper;
222+
container-type: inline-size;
223+
224+
@container bannerWrapper (max-width: 400px) {
225+
img {
226+
display: none;
227+
}
228+
}
221229
`;
222230

223231
const CloseDropdownMenu = styled(DropdownMenu)`

static/app/components/globalDrawer/components.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,6 @@ const DrawerSlidePanel = styled(SlideOverPanel)`
219219
220220
/* Apply to all scrollable children */
221221
* {
222-
overflow: hidden !important;
223222
scrollbar-width: none;
224223
225224
&::-webkit-scrollbar {

static/app/components/issues/suspect/suspectTable.tsx

Lines changed: 47 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,20 @@ import styled from '@emotion/styled';
33
import Color from 'color';
44

55
import {Flex} from 'sentry/components/container/flex';
6-
import {Alert} from 'sentry/components/core/alert';
76
import {NumberInput} from 'sentry/components/core/input/numberInput';
87
import {Tooltip} from 'sentry/components/core/tooltip';
98
import {OrderBy, SortBy} from 'sentry/components/events/featureFlags/utils';
109
import useSuspectFlagScoreThreshold from 'sentry/components/issues/suspect/useSuspectFlagScoreThreshold';
10+
import Link from 'sentry/components/links/link';
1111
import {IconSentry} from 'sentry/icons/iconSentry';
1212
import {t} from 'sentry/locale';
1313
import {space} from 'sentry/styles/space';
1414
import type {Group} from 'sentry/types/group';
1515
import {trackAnalytics} from 'sentry/utils/analytics';
1616
import toRoundedPercent from 'sentry/utils/number/toRoundedPercent';
17+
import {useLocation} from 'sentry/utils/useLocation';
1718
import useOrganization from 'sentry/utils/useOrganization';
18-
import FlagDetailsLink from 'sentry/views/issueDetails/groupFeatureFlags/details/flagDetailsLink';
19+
import {DrawerTab} from 'sentry/views/issueDetails/groupDistributions/types';
1920
import useGroupFlagDrawerData from 'sentry/views/issueDetails/groupFeatureFlags/hooks/useGroupFlagDrawerData';
2021

2122
interface Props {
@@ -26,6 +27,7 @@ interface Props {
2627

2728
export default function SuspectTable({debugSuspectScores, environments, group}: Props) {
2829
const organization = useOrganization();
30+
const location = useLocation();
2931
const [threshold, setThreshold] = useSuspectFlagScoreThreshold();
3032

3133
const {displayFlags, isPending} = useGroupFlagDrawerData({
@@ -57,27 +59,32 @@ export default function SuspectTable({debugSuspectScores, environments, group}:
5759
}
5860
}, [isPending, organization, displayFlags.length, susFlags.length, threshold]);
5961

62+
if (displayFlags.length === 0) {
63+
// If there are no display flags then we don't need this section at all.
64+
return null;
65+
}
66+
6067
if (isPending) {
6168
return (
62-
<Alert type="muted">
69+
<GradientBox>
6370
<TagHeader>
64-
{t('Suspect')}
71+
{t('Suspect Flags')}
6572
{debugThresholdInput}
6673
</TagHeader>
6774
{t('Loading...')}
68-
</Alert>
75+
</GradientBox>
6976
);
7077
}
7178

7279
if (!susFlags.length) {
7380
return (
74-
<Alert type="muted">
81+
<GradientBox>
7582
<TagHeader>
76-
{t('Suspect')}
83+
{t('Suspect Flags')}
7784
{debugThresholdInput}
7885
</TagHeader>
7986
{t('Nothing suspicious')}
80-
</Alert>
87+
</GradientBox>
8188
);
8289
}
8390

@@ -95,15 +102,24 @@ export default function SuspectTable({debugSuspectScores, environments, group}:
95102
return (
96103
<TagValueRow key={flag.key}>
97104
{/* TODO: why is flag.name transformed to TitleCase? */}
98-
<FlagDetailsLink flag={flag}>
99-
<Tooltip
100-
title={flag.key}
101-
showOnlyOnOverflow
102-
data-underline-on-hover="true"
105+
<Tooltip
106+
skipWrapper
107+
title={flag.key}
108+
showOnlyOnOverflow
109+
data-underline-on-hover="true"
110+
>
111+
<StyledLink
112+
to={{
113+
pathname: `${location.pathname}${flag.key}/`,
114+
query: {
115+
...location.query,
116+
tab: DrawerTab.FEATURE_FLAGS,
117+
},
118+
}}
103119
>
104120
{flag.key}
105-
</Tooltip>
106-
</FlagDetailsLink>
121+
</StyledLink>
122+
</Tooltip>
107123
<RightAligned>
108124
{toRoundedPercent((topValue?.count ?? 0) / flag.totalValues)}
109125
</RightAligned>
@@ -128,6 +144,9 @@ const GradientBox = styled('div')`
128144
border-radius: ${p => p.theme.borderRadius};
129145
color: ${p => p.theme.textColor};
130146
padding: ${space(1)};
147+
height: max-content;
148+
display: flex;
149+
flex-direction: column;
131150
`;
132151

133152
const TagHeader = styled('h4')`
@@ -140,21 +159,20 @@ const TagHeader = styled('h4')`
140159
font-weight: ${p => p.theme.fontWeightBold};
141160
`;
142161

143-
const progressBarWidth = '45px'; // Prevent percentages from overflowing
144162
const TagValueGrid = styled('ul')`
145163
display: grid;
146-
grid-template-columns: 4fr ${progressBarWidth} auto auto max-content auto;
147-
164+
grid-template-columns: auto max-content max-content;
165+
gap: ${space(0.25)} ${space(0.5)};
148166
margin: 0;
149167
padding: 0;
150168
list-style: none;
151169
`;
152170

153171
const TagValueRow = styled('li')`
154172
display: grid;
155-
grid-template-columns: subgrid;
156173
grid-column: 1 / -1;
157-
grid-column-gap: ${space(1)};
174+
grid-template-columns: subgrid;
175+
158176
align-items: center;
159177
padding: ${space(0.25)} ${space(0.75)};
160178
border-radius: ${p => p.theme.borderRadius};
@@ -166,6 +184,15 @@ const TagValueRow = styled('li')`
166184
}
167185
`;
168186

187+
const StyledLink = styled(Link)`
188+
${p => p.theme.overflowEllipsis};
189+
width: auto;
190+
191+
&:hover [data-underline-on-hover='true'] {
192+
text-decoration: underline;
193+
}
194+
`;
195+
169196
const RightAligned = styled('span')`
170197
text-align: right;
171198
`;

0 commit comments

Comments
 (0)