Skip to content

Commit a15dbf2

Browse files
ref(snapshots): two small UI tweaks (#112631)
Diff percent formatting: >= 1% shows 1 decimal (e.g. `93.5%`), < 1% shows up to 4 decimals without trailing zeros (e.g. `0.0227%`). Default overlay color changed to red (5th-from-last in palette). ### Legal Boilerplate Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.
1 parent dd12f3c commit a15dbf2

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

static/app/views/preprod/snapshots/main/imageDisplay/diffImageDisplay.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,12 @@ export function DiffImageDisplay({
8787
};
8888
}, [diffImageUrl]);
8989

90-
const diffPercent = pair.diff === null ? null : `${(pair.diff * 100).toFixed(1)}%`;
90+
// >= 1% shows 1 decimal (e.g. "93.5%"), < 1% shows up to 4 without trailing zeros (e.g. "0.0227%")
91+
const diffPct = pair.diff === null ? null : pair.diff * 100;
92+
const diffPercent =
93+
diffPct === null
94+
? null
95+
: `${diffPct >= 1 ? diffPct.toFixed(1) : parseFloat(diffPct.toFixed(4))}%`;
9196

9297
return (
9398
<Flex direction="column" gap="lg" padding="xl" flex="1" minHeight="0">

static/app/views/preprod/snapshots/snapshots.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export default function SnapshotsPage() {
7676
const [showOverlay, setShowOverlay] = useState(true);
7777
const [overlayColor, setOverlayColor] = useState<string>(() => {
7878
const palette = theme.chart.getColorPalette(10);
79-
return palette.at(-1) ?? '#67C800';
79+
return palette.at(-5) ?? palette[0];
8080
});
8181
const [diffMode, setDiffMode] = useState<DiffMode>('split');
8282

0 commit comments

Comments
 (0)