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
2 changes: 1 addition & 1 deletion src/app/page.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,7 +4,7 @@ import { ArrowRight } from "lucide-react";
import { getBenchmarks } from "@/data/benchmarks";
import { HeroRadar } from "@/components/hero-radar";
import { HomeBenchTable } from "@/components/home-bench-table";
import { LiveDashboard } from "@/components/live-dashboard";
import { LiveDashboard } from "@/components/live/dashboard";

export const revalidate = 60;

Expand Down
59 changes: 1 addition & 58 deletions src/components/chain-coverage-chip.tsx
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
import type { Benchmark, ProviderResult } from "@/types/benchmark";
import type { Benchmark } from "@/types/benchmark";
import { liveResults } from "@/lib/provider-filters";
import { readBestPerChain } from "@/lib/per-chain-contract";

Expand DownExpand Up@@ -144,60 +144,3 @@ export function rankOnChain(
return { rank: idx + 1, totalRanked: sorted.length };
}

/**
* Helper for badge / products page rendering. Returns the set of chain
* slugs the provider has a leadership position on for the given bench.
*/
export function leaderChains(
benchmark: Benchmark,
providerSlug: string,
): string[] {
const bestPerChain = readBestPerChain(benchmark);
if (!bestPerChain) return [];
const lower = providerSlug.toLowerCase();
return Object.entries(bestPerChain)
.filter(([, leader]) => leader.slug.toLowerCase() === lower)
.map(([chain]) => chain);
}

/**
* Build a compact "#1 on Solana · #4 on Base" sentence from a benchmark's
* per-chain leaderboard for a given provider. Returns an array of segments
* so the caller can intersperse separators. Empty array when there's no
* meaningful chain context to surface.
*/
export function perChainRankSegments(
benchmark: Benchmark,
providerSlug: string,
): { chain: string; chainLabel: string; rank: number; totalRanked: number }[] {
const bestPerChain = readBestPerChain(benchmark);
const chainOptions = benchmark.dimensions?.chain ?? [];
if (!bestPerChain || chainOptions.length === 0) return [];
const out: { chain: string; chainLabel: string; rank: number; totalRanked: number }[] = [];
for (const c of chainOptions) {
if (c.value === "all") continue;
const ranked = rankOnChain(benchmark, c.value, providerSlug);
if (!ranked) continue;
out.push({ chain: c.value, chainLabel: c.label, rank: ranked.rank, totalRanked: ranked.totalRanked });
}
return out;
}

/** Pure helper: chain label lookup (e.g. "Solana" for value "solana"). */
export function chainLabelFor(
benchmark: Benchmark,
chain: string,
): string {
return (
benchmark.dimensions?.chain?.find((c) => c.value === chain)?.label ?? chain
);
}

/** Looks up the leader for `chain` on a benchmark, or undefined. Thin
* wrapper kept here so consumers don't need a separate spec import. */
export function chainLeader(
benchmark: Benchmark,
chain: string,
): ProviderResult | undefined {
return readBestPerChain(benchmark)?.[chain];
}
6 changes: 0 additions & 6 deletions src/components/live-dashboard.tsx

This file was deleted.

7 changes: 1 addition & 6 deletions src/lib/brand.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -101,11 +101,6 @@ export function brandColor(slug: string): string | null {
return BRANDS[key(slug)]?.color ?? null;
}

/** Whether the brand color is dark enough that overlaid text should be light. */
export function brandIsDark(slug: string): boolean {
return BRANDS[key(slug)]?.dark === true;
}

/** Two-letter initials used by the fallback colored chip when no SVG logo
* is present in `public/logos/`. */
export function initials(name: string): string {
Expand All@@ -119,7 +114,7 @@ export function initials(name: string): string {
/** Perceived-luminance check used to pick a contrasting label color on top
* of the brand chip. Threshold tuned so yellows/oranges read as light
* (ink text) and saturated blues/reds as dark (paper text). */
export function isLight(hex: string): boolean {
function isLight(hex: string): boolean {
const c = hex.replace("#", "");
if (c.length !== 6) return false;
const r = parseInt(c.slice(0, 2), 16);
Expand Down
8 changes: 0 additions & 8 deletions src/lib/live/format.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,11 +36,3 @@ export function fmtLag(ms: number): string {
if (ms < 1000) return `${ms}ms`;
return `${(ms / 1000).toFixed(1)}s`;
}

export function fmtAge(sec: number): string {
if (sec < 60) return `${sec}s`;
const m = Math.floor(sec / 60);
if (m < 60) return `${m}m`;
const h = Math.floor(m / 60);
return `${h}h`;
}
Loading