Add Site Safety Assistant (ssa) role replacing reporter, supervisor and capa_owner. Portals move under /ssa (overview, my-reports, incidents, capas). Update RLS, schema, API role checks, notification recipients, nav and tests. Add db/ops/2026-11-06-merge-roles-into-ssa.sql (not yet applied; needs owner go-ahead and a pg_dump first). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
export const dynamic = 'force-dynamic'
|
|
|
|
import Link from 'next/link'
|
|
import { redirect } from 'next/navigation'
|
|
import { getSession } from '@/lib/auth/get-session'
|
|
import { buttonClass } from '@/components/ui/button'
|
|
import { IncidentTable } from '@/components/incidents/incident-table'
|
|
import { loadIncidentList } from '@/lib/incidents/list-query'
|
|
import { parseListParams } from '@/lib/incidents/list-params'
|
|
|
|
export default async function SsaInboxPage({
|
|
searchParams,
|
|
}: {
|
|
searchParams: Promise<Record<string, string | undefined>>
|
|
}) {
|
|
const session = await getSession()
|
|
if (!session) redirect('/login')
|
|
|
|
const params = parseListParams(await searchParams)
|
|
const data = await loadIncidentList(params)
|
|
|
|
return (
|
|
<div className="px-4 py-5 md:px-8 md:py-6 space-y-4">
|
|
<div className="flex items-center justify-between">
|
|
<h1 className="text-[22px] md:text-xl font-[650]">Incidents</h1>
|
|
<Link href="/report" className={buttonClass('primary')}>Report incident</Link>
|
|
</div>
|
|
<IncidentTable
|
|
incidents={data.incidents}
|
|
basePath="/ssa"
|
|
total={data.total}
|
|
counts={data.counts}
|
|
params={params}
|
|
sites={data.sites}
|
|
trucks={data.trucks}
|
|
/>
|
|
</div>
|
|
)
|
|
}
|