import Link from 'next/link'; import type { MarketRow } from '@/lib/queries/markets'; import { fmtNum, cn } from '@/lib/format'; import { Thumb } from '@/components/market/bits'; import { Badge } from '@/components/ui/primitives'; /** Browse-by-category grid: thumbnail of a representative asset, live counts, coverage state. */ export function CategoryGrid({ rows, thumbs, className, limit }: { rows: MarketRow[]; thumbs: Map; className?: string; limit?: number }) { const sorted = [...rows].sort((a, b) => b.counts.assets - a.counts.assets || a.node.sortOrder - b.node.sortOrder); const shown = limit ? sorted.slice(0, limit) : sorted; return (
{shown.map(({ node, counts, snapshot }) => { const empty = counts.assets === 0; return ( {node.name} {empty ? 'no data yet' : `${fmtNum(counts.assets, { compact: true })} assets${counts.sales ? ` ยท ${fmtNum(counts.sales, { compact: true })} sales` : ''}`} {counts.priced ? {fmtNum(counts.priced, { compact: true })} priced : !empty ? catalog : null} {snapshot?.indexValue != null ? index : null} ); })}
); }