import type { Metadata } from 'next'; import { Suspense } from 'react'; import { EventFilters } from '@/components/events/event-filters'; import { EventList } from '@/components/events/event-row'; import { EventTypeBadge } from '@/components/ui/badges'; import { Pagination, withParams } from '@/components/ui/pagination'; import { Container, Note, PageHeader, Unavailable } from '@/components/ui/section'; import { api, safe } from '@/lib/api'; import { fmtInt, fmtPctSigned } from '@/lib/format'; import { flat, int, str, type SP } from '@/lib/params'; export const metadata: Metadata = { title: 'Events', description: 'Structured corporate events detected across monitored public surfaces, with filters by type, importance, confidence, country and industry.' }; export const revalidate = 60; export default async function EventsPage({ searchParams }: { searchParams: Promise }) { const sp = await searchParams; const cur = flat(sp); const page = int(sp.page, 1); const query = { event_type: str(sp.event_type), event_subtype: str(sp.event_subtype), country: str(sp.country), industry: str(sp.industry), min_importance: str(sp.min_importance), min_confidence: str(sp.min_confidence), q: str(sp.q), origin: str(sp.origin), surface: str(sp.surface), company: str(sp.company), sort: str(sp.sort), since: str(sp.since), until: str(sp.until), page, per_page: 50 }; const [data, summary, countries, industries] = await Promise.all([safe(api.events(query)), safe(api.eventSummary(7, 'type')), safe(api.countries()), safe(api.industries())]); return ( {summary?.items.length ? (
{summary.items.slice(0, 12).map((s) => (

{fmtInt(s.count)} 0 ? 'text-positive' : (s.delta_pct ?? 0) < 0 ? 'text-danger' : 'text-ink-3'}`}>{s.delta_pct === null ? '' : fmtPctSigned(s.delta_pct, 0)}

))}

last 7 days vs previous 7

) : null} ({ value: c.code, label: c.name }))} industries={(industries?.items ?? []).map((i) => ({ value: i.slug, label: i.name }))} className="mb-4" />
{Object.entries(cur) .filter(([k, v]) => k !== 'q' && k !== 'page' && v) .map(([k, v]) => ( ))}
{!data ? ( ) : ( <>

{fmtInt(data.total)} events

withParams('/events', cur, { page: p > 1 ? p : undefined })} className="mt-4" /> )} Retracted events remain visible with a strike-through and are excluded from metrics. Duplicate detections are merged into one canonical event whose sources list every surface that corroborated it.
); }