export const dynamic = 'force-dynamic' import { createClient } from '@/lib/supabase/server' import { IncidentList, type Incident } from '@/components/incidents/incident-list' import { Pagination } from '@/components/incidents/pagination' const PAGE_SIZE = 25 export default async function SupervisorInboxPage({ searchParams, }: { searchParams: Promise<{ page?: string }> }) { const supabase = await createClient() const params = await searchParams const page = Math.max(1, Number.parseInt(params.page ?? '1', 10) || 1) const from = (page - 1) * PAGE_SIZE const { data: incidents, count } = await supabase .from('incidents') .select(` id, reference_no, incident_type, status, severity, reported_at, sites (name), zones (name), reporter:users!reported_by (name) `, { count: 'exact' }) .order('reported_at', { ascending: false }) .range(from, from + PAGE_SIZE - 1) return (

Incident Inbox

{count ?? incidents?.length ?? 0} incidents
) }