import Link from 'next/link'; import type { MarketRow } from '@/lib/queries/markets'; import { fmtMoney, fmtNum, fmtRelative, cn } from '@/lib/format'; import { Table, th, td, tdNum, Delta, Badge } from '@/components/ui/primitives'; import { heatStyle } from '@/components/charts/heat'; /** Heat table of categories (markets overview and child categories). */ export function MarketTable({ rows, showPhase = true, className }: { rows: MarketRow[]; showPhase?: boolean; className?: string }) { const sorted = [...rows].sort((a, b) => b.counts.sales - a.counts.sales || b.counts.assets - a.counts.assets || a.node.sortOrder - b.node.sortOrder); return ( {sorted.map(({ node, snapshot, counts }) => { const inactive = counts.assets === 0; return ( {(['change1d', 'change7d', 'change30d', 'change1y'] as const).map((k) => ( ))} ); })}
Category Index 1D 7D 30D 1Y Assets Priced Sales Sales 30D Volume 30D Listings Liquidity Market cap est. Last sale
{node.name} {showPhase ? ( Phase {node.phase} ) : null} {node.children.length ? {node.children.length} sub : null} {snapshot?.indexValue != null ? snapshot.indexValue.toFixed(1) : —} {fmtNum(counts.assets)} {fmtNum(counts.priced)} {fmtNum(counts.sales)} {fmtNum(counts.sales30d)} {fmtMoney(counts.volume30dUsd, 'USD', { compact: true })} {fmtNum(counts.listings)} {snapshot?.liquidityScore != null ? Math.round(snapshot.liquidityScore) : —} {snapshot?.marketCapEstUsd != null ? fmtMoney(snapshot.marketCapEstUsd, 'USD', { compact: true }) : —} {counts.lastSaleAt ? fmtRelative(counts.lastSaleAt) : '—'}
); }