import Link from 'next/link'; import type { VariantRow } from '@/lib/queries/assets'; import { fmtMoney, fmtNum, fmtRelative, cn, confidenceLabel } from '@/lib/format'; import { Table, th, td, tdNum, Badge } from '@/components/ui/primitives'; /** * Dense variant/grade matrix for md+ screens (phones use the chip selector): RIV with its band and * confidence, latest sale, sales and listings per variant. Rows link to the variant view. */ export function VariantTable({ variants, href, activeId, className }: { variants: VariantRow[]; href: (id: string | null) => string; activeId: string | null; className?: string }) { const rows = variants.slice(0, 8); if (rows.length < 2) return null; return (

By variant / grade

{variants.length} tracked · click a row to focus
{rows.map((v) => { const label = confidenceLabel(v.rivConfidence); return ( ); })}
Variant RIV Range Confidence Latest sale Sales Listings
{v.label} {v.rivUsd === null ? — : fmtMoney(v.rivUsd)} {v.rivLowUsd !== null && v.rivHighUsd !== null ? `${fmtMoney(v.rivLowUsd)} – ${fmtMoney(v.rivHighUsd)}` : —} {v.rivUsd === null ? — : {label} · n={v.rivSampleSize}} {v.latestSaleUsd === null ? — : fmtMoney(v.latestSaleUsd)} {v.latestSaleAt ? {fmtRelative(v.latestSaleAt)} : null} {fmtNum(v.salesCount)} {fmtNum(v.activeListings)}
); }