diff --git a/src/app/page.tsx b/src/app/page.tsx index 32b29289..ad114835 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -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; diff --git a/src/components/chain-coverage-chip.tsx b/src/components/chain-coverage-chip.tsx index adc4c090..d6ec1c21 100644 --- a/src/components/chain-coverage-chip.tsx +++ b/src/components/chain-coverage-chip.tsx @@ -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"; @@ -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]; -} diff --git a/src/components/live-dashboard.tsx b/src/components/live-dashboard.tsx deleted file mode 100644 index 87207d9d..00000000 --- a/src/components/live-dashboard.tsx +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Backwards-compat re-export. The live dashboard now lives in - * `src/components/live/` split into focused files. Imports of - * `@/components/live-dashboard` keep working. - */ -export { LiveDashboard } from "./live/dashboard"; diff --git a/src/lib/brand.ts b/src/lib/brand.ts index c3ff20d5..77f9d937 100644 --- a/src/lib/brand.ts +++ b/src/lib/brand.ts @@ -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 { @@ -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); diff --git a/src/lib/live/format.ts b/src/lib/live/format.ts index 160637c0..6df6c9c4 100644 --- a/src/lib/live/format.ts +++ b/src/lib/live/format.ts @@ -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`; -}