Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/app/compare/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,9 @@ export default async function ComparePage({
};

const comparisonProse = buildComparisonProse(shared, a.name, b.name);
const perpPair =
pair.hero === "perp-volume" ||
(PERP_VOLUME_COHORT.has(a.slug) && PERP_VOLUME_COHORT.has(b.slug));

return (
<main className="mx-auto max-w-5xl px-6 pt-10 pb-16 sm:pt-14">
Expand Down Expand Up @@ -981,8 +984,7 @@ export default async function ComparePage({
/>
</section>

{(pair.hero === "perp-volume" ||
(PERP_VOLUME_COHORT.has(a.slug) && PERP_VOLUME_COHORT.has(b.slug))) && (
{perpPair && (
<PerpVolumeHeadToHead
aSlug={a.slug}
bSlug={b.slug}
Expand All @@ -1002,8 +1004,11 @@ export default async function ComparePage({
bench={s}
aName={a.name}
bName={b.name}
aSlug={a.slug}
bSlug={b.slug}
// Per-card trend charts only for perp venue pairs, where the
// benches are daily or slow-moving series worth a history.
// Latency / fee benches on other pairs read as flat lines.
aSlug={perpPair ? a.slug : undefined}
bSlug={perpPair ? b.slug : undefined}
/>
))}
</div>
Expand Down
31 changes: 28 additions & 3 deletions src/components/compare-trend-chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ export function CompareTrendChart({
}

const W = 800;
const H = 150;
const PAD_L = 8;
const H = 170;
const PAD_L = 54;
const PAD_R = 8;
const PAD_T = 10;
const PAD_B = 20;
Expand Down Expand Up @@ -179,7 +179,32 @@ export function CompareTrendChart({
aria-label={`${aName} vs ${bName}, last ${range}`}
onMouseLeave={() => setHover(null)}
>
<line x1={PAD_L} x2={W - PAD_R} y1={PAD_T + plotH} y2={PAD_T + plotH} stroke="currentColor" strokeOpacity={0.2} />
{[0, 0.5, 1].map((f) => {
const v = min + f * span;
return (
<g key={f}>
<line
x1={PAD_L}
x2={W - PAD_R}
y1={y(v)}
y2={y(v)}
stroke="currentColor"
strokeOpacity={f === 0 ? 0.25 : 0.08}
/>
<text
x={PAD_L - 6}
y={y(v) + 3}
textAnchor="end"
fontSize={9}
fill="currentColor"
fillOpacity={0.55}
style={{ fontFamily: "var(--font-mono, monospace)" }}
>
{fmtUnit(v, unit)}
</text>
</g>
);
})}
<path d={path(series.a)} fill="none" stroke={aColor} strokeWidth={1.8} strokeLinejoin="round" />
<path d={path(series.b)} fill="none" stroke={bColor} strokeWidth={1.8} strokeLinejoin="round" />
{hover !== null && (
Expand Down
Loading