diff --git a/src/app/compare/[slug]/page.tsx b/src/app/compare/[slug]/page.tsx
index d70a15b9..69765b0b 100644
--- a/src/app/compare/[slug]/page.tsx
+++ b/src/app/compare/[slug]/page.tsx
@@ -1,5 +1,4 @@
import type { Metadata } from "next";
-import { Fragment } from "react";
import { notFound, redirect } from "next/navigation";
import Link from "next/link";
import { ArrowLeft, ArrowUpRight } from "lucide-react";
@@ -12,13 +11,12 @@ import {
} from "@/data/compare-pairs";
import { getProviderRegistry } from "@/data/provider-registry";
import { ProviderLogo } from "@/components/provider-logo";
-import { fmtUnit, fmtValue, unitSuffix } from "@/lib/format";
+import { fmtUnit } from "@/lib/format";
import { capDescription } from "@/lib/seo-text";
import { Breadcrumb } from "@/components/breadcrumb";
import { buildBreadcrumbJsonLd, safeJsonLd } from "@/lib/jsonld";
import { SITE } from "@/data/site";
import { CREATOR_PUBLISHER, DATASET_LICENSE } from "@/lib/dataset-jsonld";
-import type { Benchmark } from "@/types/benchmark";
import { CompareBenchCard } from "@/components/compare-bench-card";
import type { CompareBench } from "@/components/compare-bench-card";
import {
@@ -989,360 +987,3 @@ function ProviderHeader({
);
}
-function BenchCard({
- bench,
- aName,
- bName,
-}: {
- bench: SharedBench;
- aName: string;
- bName: string;
-}) {
- return (
-
-
-
-
- {bench.title}
-
-
-
- {bench.category}
-
-
-
-
-
- {bench.chainRegionMatrix.length > 0 ? (
-
- ) : (
- <>
- {bench.chainBreakdown.length > 0 && (
-
- )}
- {bench.regionBreakdown.length > 0 && (
-
- )}
- >
- )}
-
-
-
- );
-}
-
-function AggregatePanel({
- name,
- panel,
- unit,
- winner,
- loser,
-}: {
- name: string;
- panel: Panel;
- unit: Benchmark["unit"];
- winner: boolean;
- loser: boolean;
-}) {
- const hasData = panel.rank > 0 && panel.p50 > 0;
- const containerCls = winner
- ? "border-good/60 bg-good/5"
- : loser
- ? "border-bad/40 bg-bad/5"
- : "border-rule bg-surface";
- const headlineCls = winner
- ? "text-good"
- : loser
- ? "text-bad"
- : "text-ink";
- return (
-
-
-
- {name}
-
- {winner && hasData && (
-
- Leads
-
- )}
- {loser && hasData && (
-
- Trails
-
- )}
-
- {hasData ? (
- <>
-
- {fmtValue(panel.p50, unit)}
-
- {unitSuffix(unit, panel.p50)}
-
-
-
- - p99
- -
- {fmtUnit(panel.p99, unit)}
-
- - rank
- - #{panel.rank}
- {panel.sampleSize ? (
- <>
- - samples
- -
- {Math.round(panel.sampleSize).toLocaleString()}
-
- >
- ) : null}
-
- >
- ) : (
-
No data in window
- )}
-
- );
-}
-
-/** Single flat 2D matrix used when a bench exposes both `chain` and
- * `region` dimensions. Rows are grouped per chain (rowspan on the chain
- * cell), two sub-rows per chain (one per provider). Columns expand
- * across every region observed for the pair plus an aggregate column on
- * the right. Each value cell is colored by the per-cell winner so the
- * table reads as a heatmap: green = leads here, red = trails. */
-function ChainRegionMatrix({
- entries,
- aName,
- bName,
- unit,
-}: {
- entries: ChainRegionEntry[];
- aName: string;
- bName: string;
- unit: Benchmark["unit"];
-}) {
- const regionMap = new Map();
- for (const entry of entries) {
- for (const r of entry.regionRows) {
- if (!regionMap.has(r.value)) regionMap.set(r.value, r.label);
- }
- }
- const regions = Array.from(regionMap.entries()).map(([value, label]) => ({
- value,
- label,
- }));
-
- const valueCell = (win: boolean, lose: boolean, isAggregate = false) => {
- const color = win
- ? "text-good font-medium"
- : lose
- ? "text-bad"
- : "text-ink";
- return `py-2 px-2 text-right whitespace-nowrap ${isAggregate ? "border-l border-rule" : ""} ${color}`;
- };
- const emptyCell = (isAggregate = false) =>
- `py-2 px-2 text-right text-ink-faint ${isAggregate ? "border-l border-rule" : ""}`;
-
- return (
-
-
- Per chain · per region
-
-
-
-
-
- |
- Chain
- |
-
- Provider
- |
- {regions.map((r) => (
-
- {r.label}
- |
- ))}
-
- Aggregate
- |
-
-
-
- {entries.map((entry) => {
- const byRegion = new Map(
- entry.regionRows.map((r) => [r.value, r] as const),
- );
- return (
-
-
- |
- {entry.label}
- |
-
- {aName}
- |
- {regions.map((r) => {
- const row = byRegion.get(r.value);
- return row ? (
-
- {fmtUnit(row.aP50, unit)}
- |
- ) : (
-
- -
- |
- );
- })}
-
- {fmtUnit(entry.aP50, unit)}
- |
-
-
- |
- {bName}
- |
- {regions.map((r) => {
- const row = byRegion.get(r.value);
- return row ? (
-
- {fmtUnit(row.bP50, unit)}
- |
- ) : (
-
- -
- |
- );
- })}
-
- {fmtUnit(entry.bP50, unit)}
- |
-
-
- );
- })}
-
-
-
-
- );
-}
-
-function BreakdownTable({
- title,
- rows,
- aName,
- bName,
- unit,
-}: {
- title: string;
- rows: BreakdownRow[];
- aName: string;
- bName: string;
- unit: Benchmark["unit"];
-}) {
- return (
-
-
- {title}
-
-
-
-
-
- |
- {title === "Per region" ? "Region" : "Chain"}
- |
- {aName} |
- {bName} |
-
-
-
- {rows.map((row) => (
-
- | {row.label} |
-
- {fmtUnit(row.aP50, unit)}
- |
-
- {fmtUnit(row.bP50, unit)}
- |
-
- ))}
-
-
-
-
- );
-}