Skip to content

Commit 47dd7cf

Browse files
fix(codecov): Fix line coverage legend edge cases and coloring (#102742)
Followup to #102450 to fix edge cases of when pills have long, individual text that doesn't wrap. <img width="2264" height="792" alt="image" src="https://github.com/user-attachments/assets/5a2151ec-c752-4e88-9611-9b2a6698535d" /> Solution: drop the legend on to its own line below and shrink a little bit to prevent taking away too much attention away from the pills. Small screen width with wrapping: <img width="512" height="385" alt="Screenshot 2025-11-04 at 3 55 08 PM" src="https://github.com/user-attachments/assets/ca46f2af-9dac-4313-a70e-cbb6280778e1" /> Normal case: <img width="917" height="410" alt="Screenshot 2025-11-04 at 3 55 21 PM" src="https://github.com/user-attachments/assets/8dd9f47f-33a3-4508-8153-62278d1f883e" />
1 parent 8194c07 commit 47dd7cf

File tree

3 files changed

+37
-37
lines changed

3 files changed

+37
-37
lines changed

static/app/components/events/interfaces/crashContent/exception/content.tsx

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

44
import {Button} from 'sentry/components/core/button';
5-
import {Flex} from 'sentry/components/core/layout/flex';
5+
import {Container} from 'sentry/components/core/layout';
66
import {Tooltip} from 'sentry/components/core/tooltip';
77
import ErrorBoundary from 'sentry/components/errorBoundary';
88
import {StacktraceBanners} from 'sentry/components/events/interfaces/crashContent/exception/banners/stacktraceBanners';
@@ -205,16 +205,15 @@ function InnerContent({
205205
<ToggleExceptionButton
206206
{...{hiddenExceptions, toggleRelatedExceptions, values, exception}}
207207
/>
208-
{exception.mechanism || hasCoverageData ? (
209-
<RowWrapper direction="row" justify="between">
210-
{exception.mechanism && (
211-
<Mechanism
212-
data={exception.mechanism}
213-
meta={meta?.[exceptionIdx]?.mechanism}
214-
/>
215-
)}
216-
{hasCoverageData ? <LineCoverageLegend /> : null}
217-
</RowWrapper>
208+
{exception.mechanism ? (
209+
<Container paddingTop="xl">
210+
<Mechanism data={exception.mechanism} meta={meta?.[exceptionIdx]?.mechanism} />
211+
</Container>
212+
) : null}
213+
{hasCoverageData ? (
214+
<Container paddingTop="md">
215+
<LineCoverageLegend />
216+
</Container>
218217
) : null}
219218
<RelatedExceptions
220219
mechanism={exception.mechanism}
@@ -411,7 +410,3 @@ const StyledFoldSection = styled(FoldSection)`
411410
margin-right: ${p => p.theme.space.xl};
412411
}
413412
`;
414-
415-
const RowWrapper = styled(Flex)`
416-
margin: ${p => p.theme.space.xl} 0 ${p => p.theme.space.xs} 0;
417-
`;
Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,38 @@
11
import styled from '@emotion/styled';
22

3-
import {Flex} from 'sentry/components/core/layout/flex';
3+
import {Container, Flex} from 'sentry/components/core/layout';
4+
import {Text} from 'sentry/components/core/text/text';
45
import {coverageText as COVERAGE_TEXT} from 'sentry/components/events/interfaces/frame/contextLineNumber';
56
import {Coverage} from 'sentry/types/integrations';
67

78
export function LineCoverageLegend() {
89
return (
9-
<Flex gap="2xl" align="center" direction="row" paddingBottom="md">
10-
<CoveredLine>{COVERAGE_TEXT[Coverage.COVERED]}</CoveredLine>
11-
<UncoveredLine>{COVERAGE_TEXT[Coverage.NOT_COVERED]}</UncoveredLine>
12-
<PartiallyCoveredLine>{COVERAGE_TEXT[Coverage.PARTIAL]}</PartiallyCoveredLine>
10+
<Flex gap="2xl" align="center" direction="row" wrap="wrap">
11+
<SolidLegendEntry paddingRight="md" borderRight="success">
12+
<Text size="sm" wrap="nowrap">
13+
{COVERAGE_TEXT[Coverage.COVERED]}
14+
</Text>
15+
</SolidLegendEntry>
16+
<SolidLegendEntry paddingRight="md" borderRight="danger">
17+
<Text size="sm" wrap="nowrap">
18+
{COVERAGE_TEXT[Coverage.NOT_COVERED]}
19+
</Text>
20+
</SolidLegendEntry>
21+
<DashedLegendEntry paddingRight="md" borderRight="warning">
22+
<Text size="sm" wrap="nowrap">
23+
{COVERAGE_TEXT[Coverage.PARTIAL]}
24+
</Text>
25+
</DashedLegendEntry>
1326
</Flex>
1427
);
1528
}
1629

17-
const CoveredLine = styled('div')`
18-
padding-right: ${p => p.theme.space.md};
19-
border-right: 3px solid ${p => p.theme.tokens.content.success};
20-
white-space: nowrap;
30+
const SolidLegendEntry = styled(Container)`
31+
border-right-width: 3px;
32+
border-right-style: solid;
2133
`;
2234

23-
const UncoveredLine = styled('div')`
24-
padding-right: ${p => p.theme.space.md};
25-
border-right: 3px solid ${p => p.theme.tokens.content.danger};
26-
white-space: nowrap;
27-
`;
28-
29-
const PartiallyCoveredLine = styled('div')`
30-
padding-right: ${p => p.theme.space.md};
31-
border-right: 3px dashed ${p => p.theme.tokens.content.warning};
32-
white-space: nowrap;
35+
const DashedLegendEntry = styled(Container)`
36+
border-right-width: 3px;
37+
border-right-style: dashed;
3338
`;

static/app/components/events/interfaces/frame/contextLineNumber.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,17 @@ const Wrapper = styled('div')`
6969
7070
&.covered .line-number {
7171
background: ${p => p.theme.green100};
72-
border-right: 3px solid ${p => p.theme.tokens.content.success};
72+
border-right: 3px solid ${p => p.theme.tokens.border.success};
7373
}
7474
7575
&.uncovered .line-number {
7676
background: ${p => p.theme.red100};
77-
border-right: 3px solid ${p => p.theme.tokens.content.danger};
77+
border-right: 3px solid ${p => p.theme.tokens.border.danger};
7878
}
7979
8080
&.partial .line-number {
8181
background: ${p => p.theme.yellow100};
82-
border-right: 3px dashed ${p => p.theme.tokens.content.warning};
82+
border-right: 3px dashed ${p => p.theme.tokens.border.warning};
8383
}
8484
8585
&.active {

0 commit comments

Comments
 (0)