refactor(design): replace status, priority and severity color maps with StatusTag and mono tokens

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-30 19:08:18 +08:00
co-authored by Claude Haiku 4.5
parent 0b5020b3d0
commit ba9eeefe47
12 changed files with 45 additions and 125 deletions
+4 -12
View File
@@ -2,6 +2,7 @@
import { useState } from 'react'
import Link from 'next/link'
import { StatusTag } from '@/components/ui/status-tag'
const TYPE_LABELS: Record<string, string> = {
injury: 'Injury / Medical',
@@ -14,14 +15,7 @@ const TYPE_LABELS: Record<string, string> = {
transport: 'Transport / Vehicle',
}
const STATUS_COLORS: Record<string, string> = {
reported: 'bg-yellow-100 text-yellow-800',
triaged: 'bg-blue-100 text-blue-800',
investigating: 'bg-purple-100 text-purple-800',
capa_pending: 'bg-orange-100 text-orange-800',
verification: 'bg-indigo-100 text-indigo-800',
closed: 'bg-green-100 text-green-800',
}
const STATUS_ORDER = ['reported', 'triaged', 'investigating', 'capa_pending', 'verification', 'closed'] as const
export type Incident = {
id: string
@@ -86,7 +80,7 @@ export function IncidentList({ incidents, basePath }: Props) {
onChange={e => setStatusFilter(e.target.value)}
>
<option value="">All statuses</option>
{Object.keys(STATUS_COLORS).map(s => (
{STATUS_ORDER.map(s => (
<option key={s} value={s}>{s.replace(/_/g, ' ')}</option>
))}
</select>
@@ -107,9 +101,7 @@ export function IncidentList({ incidents, basePath }: Props) {
<span className="font-mono text-sm font-semibold text-gray-900">
{inc.reference_no ?? '—'}
</span>
<span className={`text-xs px-2 py-0.5 rounded-full font-medium ${STATUS_COLORS[inc.status] ?? 'bg-gray-100 text-gray-700'}`}>
{inc.status.replace(/_/g, ' ').toUpperCase()}
</span>
<StatusTag status={inc.status}>{inc.status.replace(/_/g, ' ').toUpperCase()}</StatusTag>
</div>
<div className="text-sm text-gray-600">
{TYPE_LABELS[inc.incident_type] ?? inc.incident_type}