Skip to content

Commit e967b76

Browse files
authored
Update/compare modal styling (#33)
* made columns closer * inlined leaderboard * removed blue horizontal line * Fixed scroll bar issue * fixed axis label styling for cost * get rid of trailing zeros
1 parent f2df2d2 commit e967b76

3 files changed

Lines changed: 26 additions & 8 deletions

File tree

src/components/CompareModal.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ const CompareModal: React.FC<CompareModalProps> = ({
103103
.slice(0, 6);
104104
}, [searchTerm, routerIds]);
105105

106-
const spiderChartHeight = isCompactLayout ? 420 : 520;
106+
const spiderChartHeight = isCompactLayout ? 360 : 460;
107107
const spiderOuterRadius = isCompactLayout ? '65%' : '80%';
108108
const spiderChartMargin = isCompactLayout
109109
? { top: 32, right: 32, bottom: 32, left: 32 }
@@ -260,6 +260,18 @@ useEffect(() => {
260260
const spiderChartDomain: [number, number] =
261261
activeMetric === 'cost' ? spiderValueDomain : [0, 100];
262262

263+
const formatSpiderTick = useCallback(
264+
(value: number) => {
265+
if (activeMetric === 'cost') {
266+
if (!Number.isFinite(value)) return '$0';
267+
const precise = value.toFixed(6).replace(/0+$/, '').replace(/\.$/, '.0');
268+
return `$${precise}`;
269+
}
270+
return value.toFixed(0);
271+
},
272+
[activeMetric]
273+
);
274+
263275
useEffect(() => {
264276
if (activeBarAxis && !currentAxes.includes(activeBarAxis)) {
265277
setActiveBarAxis('');
@@ -730,7 +742,7 @@ useEffect(() => {
730742
</text>
731743
)}
732744
/>
733-
<PolarRadiusAxis domain={spiderValueDomain} tickCount={5} />
745+
<PolarRadiusAxis domain={spiderValueDomain} tickCount={5} tickFormatter={formatSpiderTick} />
734746
{routerIds.map((id, index) => (
735747
<Radar
736748
key={id}

src/components/DifficultyBarPanel.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,11 @@ const DifficultyBarPanel: React.FC<DifficultyBarPanelProps> = ({
9595
position="right"
9696
formatter={(value: number) => {
9797
if (metricKey === 'cost') {
98-
return value.toFixed(5);
98+
const safeValue = Number.isFinite(value) ? value : 0;
99+
const precise = safeValue.toFixed(5).replace(/0+$/, '').replace(/\.$/, '.0');
100+
return `$${precise}`;
99101
}
100-
return value.toFixed(1);
102+
return Number.isFinite(value) ? value.toFixed(1) : '0.0';
101103
}}
102104
fill="#0f172a"
103105
fontSize={12}

src/pages/LeaderboardPage.css

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -635,14 +635,17 @@
635635
border-radius: 24px;
636636
padding: 1.5rem;
637637
width: min(1200px, 100%);
638-
height: 82vh; /* 👈 FIXED height */
639-
overflow: scroll; /* 👈 prevent modal scrolling */
638+
height: 82vh;
639+
overflow: hidden;
640640
display: flex;
641641
flex-direction: column;
642642
}
643643

644644
.compare-modal-body {
645+
flex: 1;
645646
min-height: 0;
647+
overflow-y: auto;
648+
overflow-x: hidden;
646649
}
647650
.compare-modal-header {
648651
display: flex;
@@ -681,6 +684,7 @@
681684
min-height: 100vh;
682685
border-radius: 0;
683686
padding: 1rem;
687+
overflow-y: auto;
684688
}
685689

686690
.compare-modal-body {
@@ -842,10 +846,10 @@
842846

843847

844848

845-
849+
/*
846850
.compare-modal-chart.primary {
847851
min-height: 480px;
848-
}
852+
} */
849853

850854
@media (max-width: 768px) {
851855
.compare-modal-chart.primary {

0 commit comments

Comments
 (0)