Skip to content
Merged
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
27 changes: 26 additions & 1 deletion src/app/alternatives/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ import { citableAsOf } from "@/lib/citation";
import { ProviderLogo } from "@/components/provider-logo";
import { ProviderTypeBadge } from "@/components/provider-type-badge";
import { isRegion } from "@/lib/brand";
import { PERP_VENUE_META, benchRowsForVenue } from "@/lib/perp-venue-context";
import { fetchPerpCohort } from "@/lib/perp-stats";
import { loadBenchFromBlob } from "@/lib/bench-blob";
import { PerpVenueBenchCards } from "@/components/perp-venue-bench-cards";

export const revalidate = 60;

Expand Down Expand Up @@ -63,9 +67,21 @@ export default async function AlternativePage({
params: Promise<Params>;
}) {
const { slug } = await params;
const alt = await loadAlternative(slug);
const isPerpVenue = slug in PERP_VENUE_META;

const [alt, cohort, feesAtSizeBench] = await Promise.all([
loadAlternative(slug),
isPerpVenue ? fetchPerpCohort() : Promise.resolve(null),
isPerpVenue ? loadBenchFromBlob("perp-fees-at-size") : Promise.resolve(null),
]);
if (!alt) notFound();

const venueRow = cohort?.venues.find((v) => v.slug === slug) ?? null;
const perpBenchRows =
cohort && venueRow
? benchRowsForVenue(cohort, venueRow, feesAtSizeBench)
: [];

const { bench } = alt;
const isDraft = bench.status === "draft";
const { fieldMin, fieldMedian, fieldMax, tailMin, tailMax, tailSpread } =
Expand Down Expand Up @@ -244,6 +260,15 @@ export default async function AlternativePage({
</p>
)}

{perpBenchRows.length > 0 && (
<section className="mt-10">
<SectionLabel>{alt.target_product} across benchmarks</SectionLabel>
<div className="mt-4">
<PerpVenueBenchCards rows={perpBenchRows} />
</div>
</section>
)}

{/* Top alternatives cards - explicit list with internal links to
product pages. The bench leaderboard below carries the full data;
this section frames the answer for skim-readers and search. */}
Expand Down
Loading