import type { Metadata } from 'next'; import Link from 'next/link'; import { PageHeader } from '@/components/ui/page-header'; import { Card, CardHeader, EmptyState, Table, th, td, tdNum } from '@/components/ui/primitives'; import { BarChart } from '@/components/charts/bar-chart'; import { getDbGraders, getGradePremiums, getGraderActivity } from '@/lib/queries/market-lists'; import { fmtMoney, fmtNum, fmtRelative, cn } from '@/lib/format'; import { catName } from '@/lib/taxonomy'; export const metadata: Metadata = { title: 'Grading', description: 'Grading companies, scales, empirical grade premiums and population data. PSA 10, BGS 10 and CGC 10 are never assumed equivalent.' }; export const revalidate = 600; export default async function GradingPage() { const [graders, premiums, activity] = await Promise.all([getDbGraders(), getGradePremiums(), getGraderActivity()]); const act = new Map(activity.map((a) => [a.grader, a])); const byCat = new Map(); for (const p of premiums) (byCat.get(p.categorySlug) ?? byCat.set(p.categorySlug, []).get(p.categorySlug)!).push(p); return (
{graders.map((g) => { const a = act.get(g.slug); return ( ); })}
Grader Scale Categories Graded sales Assets Median sale Pop reports Links
{g.name} {g.scale.type} {g.scale.top ? ` · top ${g.scale.top}` : ''} {g.scale.values.length ? ` · ${g.scale.values.length} steps` : ''} {g.categorySlugs.map(catName).join(', ') || '—'} {fmtNum(a?.sales ?? 0)} {fmtNum(a?.assets ?? 0)} {a?.medianUsd != null ? fmtMoney(a.medianUsd) : '—'} {fmtNum(a?.populationReports ?? 0)} {g.populationUrl ? ( Population ↗ ) : null} {g.verifyUrl ? ( Verify ↗ ) : null}
{byCat.size ? (
{[...byCat.entries()].map(([cat, rows]) => (

{catName(cat)} updated {fmtRelative(rows[0]!.computedAt)}

({ label: `${r.grader.toUpperCase()} ${r.grade}`, value: r.marketMultiplier, sublabel: `n=${r.sampleSize}` }))} maxBars={14} />
))}
) : ( )}

RareIndex does not grade or authenticate items. Certification numbers shown on sales and listings are as published by the source; verify them with the grading company.

); }