fix: export Incident types, replace any casts with typed unknown casts
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AWxyMibCuGGtSQSqfajDQ7
This commit is contained in:
@@ -33,7 +33,7 @@ export default async function HseDashboardPage() {
|
|||||||
|
|
||||||
const siteMap: Record<string, number> = {}
|
const siteMap: Record<string, number> = {}
|
||||||
for (const r of rows) {
|
for (const r of rows) {
|
||||||
const name = (r.sites as any)?.name ?? 'Unknown'
|
const name = (r.sites as { name: string } | null)?.name ?? 'Unknown'
|
||||||
siteMap[name] = (siteMap[name] ?? 0) + 1
|
siteMap[name] = (siteMap[name] ?? 0) + 1
|
||||||
}
|
}
|
||||||
const by_site = Object.entries(siteMap).map(([name, count]) => ({ name, count }))
|
const by_site = Object.entries(siteMap).map(([name, count]) => ({ name, count }))
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ export const dynamic = 'force-dynamic'
|
|||||||
import { notFound } from 'next/navigation'
|
import { notFound } from 'next/navigation'
|
||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
import { createClient } from '@/lib/supabase/server'
|
import { createClient } from '@/lib/supabase/server'
|
||||||
import { IncidentDetail } from '@/components/incidents/incident-detail'
|
import { IncidentDetail, type Incident } from '@/components/incidents/incident-detail'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
params: Promise<{ id: string }>
|
params: Promise<{ id: string }>
|
||||||
@@ -35,7 +35,7 @@ export default async function HseIncidentDetailPage({ params }: Props) {
|
|||||||
<Link href="/hse/incidents" className="text-sm text-blue-600 hover:underline mb-4 inline-block">
|
<Link href="/hse/incidents" className="text-sm text-blue-600 hover:underline mb-4 inline-block">
|
||||||
← Back to inbox
|
← Back to inbox
|
||||||
</Link>
|
</Link>
|
||||||
<IncidentDetail incident={incident as any} />
|
<IncidentDetail incident={incident as unknown as Incident} />
|
||||||
</main>
|
</main>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
export const dynamic = 'force-dynamic'
|
export const dynamic = 'force-dynamic'
|
||||||
|
|
||||||
import { createClient } from '@/lib/supabase/server'
|
import { createClient } from '@/lib/supabase/server'
|
||||||
import { IncidentList } from '@/components/incidents/incident-list'
|
import { IncidentList, type Incident } from '@/components/incidents/incident-list'
|
||||||
|
|
||||||
export default async function HseInboxPage() {
|
export default async function HseInboxPage() {
|
||||||
const supabase = await createClient()
|
const supabase = await createClient()
|
||||||
@@ -23,7 +23,7 @@ export default async function HseInboxPage() {
|
|||||||
<h1 className="text-2xl font-bold text-gray-900">Incident Inbox</h1>
|
<h1 className="text-2xl font-bold text-gray-900">Incident Inbox</h1>
|
||||||
<span className="text-sm text-gray-500">{incidents?.length ?? 0} incidents</span>
|
<span className="text-sm text-gray-500">{incidents?.length ?? 0} incidents</span>
|
||||||
</div>
|
</div>
|
||||||
<IncidentList incidents={(incidents ?? []) as any} basePath="/hse" />
|
<IncidentList incidents={(incidents ?? []) as unknown as Incident[]} basePath="/hse" />
|
||||||
</main>
|
</main>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ export const dynamic = 'force-dynamic'
|
|||||||
import { notFound } from 'next/navigation'
|
import { notFound } from 'next/navigation'
|
||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
import { createClient } from '@/lib/supabase/server'
|
import { createClient } from '@/lib/supabase/server'
|
||||||
import { IncidentDetail } from '@/components/incidents/incident-detail'
|
import { IncidentDetail, type Incident } from '@/components/incidents/incident-detail'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
params: Promise<{ id: string }>
|
params: Promise<{ id: string }>
|
||||||
@@ -35,7 +35,7 @@ export default async function SupervisorIncidentDetailPage({ params }: Props) {
|
|||||||
<Link href="/supervisor/incidents" className="text-sm text-blue-600 hover:underline mb-4 inline-block">
|
<Link href="/supervisor/incidents" className="text-sm text-blue-600 hover:underline mb-4 inline-block">
|
||||||
← Back to inbox
|
← Back to inbox
|
||||||
</Link>
|
</Link>
|
||||||
<IncidentDetail incident={incident as any} />
|
<IncidentDetail incident={incident as unknown as Incident} />
|
||||||
</main>
|
</main>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
export const dynamic = 'force-dynamic'
|
export const dynamic = 'force-dynamic'
|
||||||
|
|
||||||
import { createClient } from '@/lib/supabase/server'
|
import { createClient } from '@/lib/supabase/server'
|
||||||
import { IncidentList } from '@/components/incidents/incident-list'
|
import { IncidentList, type Incident } from '@/components/incidents/incident-list'
|
||||||
|
|
||||||
export default async function SupervisorInboxPage() {
|
export default async function SupervisorInboxPage() {
|
||||||
const supabase = await createClient()
|
const supabase = await createClient()
|
||||||
@@ -23,7 +23,7 @@ export default async function SupervisorInboxPage() {
|
|||||||
<h1 className="text-2xl font-bold text-gray-900">Incident Inbox</h1>
|
<h1 className="text-2xl font-bold text-gray-900">Incident Inbox</h1>
|
||||||
<span className="text-sm text-gray-500">{incidents?.length ?? 0} incidents</span>
|
<span className="text-sm text-gray-500">{incidents?.length ?? 0} incidents</span>
|
||||||
</div>
|
</div>
|
||||||
<IncidentList incidents={(incidents ?? []) as any} basePath="/supervisor" />
|
<IncidentList incidents={(incidents ?? []) as unknown as Incident[]} basePath="/supervisor" />
|
||||||
</main>
|
</main>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ const MEDICAL_LABELS: Record<string, string> = {
|
|||||||
lti: 'Lost Time Injury (LTI)',
|
lti: 'Lost Time Injury (LTI)',
|
||||||
}
|
}
|
||||||
|
|
||||||
type Incident = {
|
export type Incident = {
|
||||||
id: string
|
id: string
|
||||||
reference_no: string | null
|
reference_no: string | null
|
||||||
incident_type: string
|
incident_type: string
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ const STATUS_COLORS: Record<string, string> = {
|
|||||||
closed: 'bg-green-100 text-green-800',
|
closed: 'bg-green-100 text-green-800',
|
||||||
}
|
}
|
||||||
|
|
||||||
type Incident = {
|
export type Incident = {
|
||||||
id: string
|
id: string
|
||||||
reference_no: string | null
|
reference_no: string | null
|
||||||
incident_type: string
|
incident_type: string
|
||||||
|
|||||||
Reference in New Issue
Block a user