import type { Metadata } from 'next'; import { PageHeader } from '@/components/ui/page-header'; import { Tabs } from '@/components/ui/tabs'; import { Card, EmptyState, Badge } from '@/components/ui/primitives'; import { Pagination } from '@/components/ui/pagination'; import { listNews } from '@/lib/queries/market-lists'; import { fmtDate } from '@/lib/format'; import { catName, humanize } from '@/lib/taxonomy'; import { sp1, spInt, type SP } from '@/lib/search-params'; export const metadata: Metadata = { title: 'Market news', description: 'Collectibles market news: auction results, record sales, grading changes, releases, trends, discoveries and events, summarised with links to the source.' }; const TYPES = ['auction_results', 'record_sales', 'grading', 'releases', 'trends', 'discoveries', 'events']; export default async function NewsPage({ searchParams }: { searchParams: Promise }) { const sp = await searchParams; const type = sp1(sp, 'type') ?? null; const category = sp1(sp, 'category') ?? null; const page = spInt(sp, 'page'); const res = await listNews({ type, category, page, limit: 40 }); return (
({ id: t, label: humanize(t), href: `/news?type=${t}` }))]} className="mb-4" /> {res.items.length ? ( <>
    {res.items.map((n) => (
  • {n.newsType ? {humanize(n.newsType)} : null} {n.sourceName} · {n.publishedAt ? fmtDate(n.publishedAt) : 'undated'}
    {n.title} {n.aiSummary || n.summary ?

    {n.aiSummary ?? n.summary}

    : null} {n.categorySlugs.length ?
    {n.categorySlugs.map(catName).join(' · ')}
    : null}
  • ))}
) : ( )}
); }