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, Badge } from '@/components/ui/primitives'; import { Tabs } from '@/components/ui/tabs'; import { LotsTable } from '@/components/market/sales-table'; import { listAuctionHouses, listAuctions, listLots } from '@/lib/queries/market-lists'; import { fmtDate, fmtNum, fmtRelative, cn } from '@/lib/format'; import { catName } from '@/lib/taxonomy'; import { spEnum, type SP } from '@/lib/search-params'; export const metadata: Metadata = { title: 'Auctions', description: 'Auction houses, live and upcoming lots, ending-soon lots and results across the collectibles market.' }; export default async function AuctionsPage({ searchParams }: { searchParams: Promise }) { const sp = await searchParams; const tab = spEnum(sp, 'tab', ['ending', 'live', 'upcoming', 'results', 'houses'] as const, 'ending'); const [houses, ending, lots, auctions] = await Promise.all([ listAuctionHouses(), listLots({ endingWithinHours: 72, limit: 60 }), tab === 'results' ? listLots({ status: 'ended', limit: 60, sort: 'value' }) : tab === 'live' ? listLots({ status: 'live', limit: 60 }) : tab === 'upcoming' ? listLots({ status: 'upcoming', limit: 60 }) : Promise.resolve([]), listAuctions({ limit: 100 }), ]); return (
Auction calendar → } /> {tab === 'houses' ? ( {houses.length ? ( {houses.map((h) => ( ))}
House Auctions Lots tracked Open
{h.house} {fmtNum(h.auctions)} {fmtNum(h.lots)} {fmtNum(h.upcoming)}
) : ( )}
) : (
{auctions.length ? (
    {auctions.slice(0, 40).map((a) => (
  • {a.name}
    {a.status} {a.auctionHouse} · {a.endsAt ? `ends ${fmtDate(a.endsAt)} (${fmtRelative(a.endsAt)})` : a.startsAt ? `starts ${fmtDate(a.startsAt)}` : 'dates n/a'} · {a.lotsTracked} lots{a.lotCount ? ` / ${a.lotCount}` : ''} {a.categorySlugs.slice(0, 2).map((c) => ( · {catName(c)} ))}
  • ))}
) : ( )}
)}
); }