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
@@ -6,17 +6,12 @@ import { redirect, notFound } from 'next/navigation'
import { getSession } from '@/lib/auth/get-session'
import { incidents, sites, zones, capaActions } from '@/lib/db/schema'
import { eq, and } from 'drizzle-orm'
import { StatusTag } from '@/components/ui/status-tag'
const STATUS_LABELS: Record<string, string> = {
reported: 'Reported', triaged: 'Triaged', investigating: 'Investigating',
capa_pending: 'CAPA Pending', verification: 'Verification', closed: 'Closed',
}
const STATUS_COLORS: Record<string, string> = {
reported: 'bg-gray-100 text-gray-600', triaged: 'bg-yellow-100 text-yellow-800',
investigating: 'bg-blue-100 text-blue-700', capa_pending: 'bg-orange-100 text-orange-700',
verification: 'bg-purple-100 text-purple-700', closed: 'bg-green-100 text-green-700',
}
export default async function ReporterIncidentDetail({
params,
}: {
@@ -74,9 +69,7 @@ export default async function ReporterIncidentDetail({
<h1 className="text-lg font-bold text-gray-900">{inc.referenceNo ?? inc.id.slice(0, 8)}</h1>
<p className="text-sm text-gray-500 capitalize">{inc.incidentType?.replace(/_/g, ' ')}</p>
</div>
<span className={`text-xs rounded-full px-2 py-1 shrink-0 ${STATUS_COLORS[inc.status] ?? 'bg-gray-100 text-gray-600'}`}>
{STATUS_LABELS[inc.status] ?? inc.status}
</span>
<span className="shrink-0"><StatusTag status={inc.status}>{STATUS_LABELS[inc.status] ?? inc.status}</StatusTag></span>
</div>
<div className="grid grid-cols-2 gap-3 text-sm mb-4">
+2 -12
View File
@@ -6,6 +6,7 @@ import { redirect } from 'next/navigation'
import { getSession } from '@/lib/auth/get-session'
import { incidents, sites } from '@/lib/db/schema'
import { eq, desc } from 'drizzle-orm'
import { StatusTag } from '@/components/ui/status-tag'
const STATUS_LABELS: Record<string, string> = {
reported: 'Reported',
@@ -16,15 +17,6 @@ const STATUS_LABELS: Record<string, string> = {
closed: 'Closed',
}
const STATUS_COLORS: Record<string, string> = {
reported: 'bg-gray-100 text-gray-600',
triaged: 'bg-yellow-100 text-yellow-800',
investigating: 'bg-blue-100 text-blue-700',
capa_pending: 'bg-orange-100 text-orange-700',
verification: 'bg-purple-100 text-purple-700',
closed: 'bg-green-100 text-green-700',
}
const TYPE_LABELS: Record<string, string> = {
injury: 'Injury', near_miss: 'Near Miss', hazard: 'Hazard',
asset_damage: 'Asset Damage', environmental: 'Environmental', security: 'Security', fire: 'Fire',
@@ -110,9 +102,7 @@ export default async function ReporterPage() {
</p>
)}
</div>
<span className={`text-xs rounded-full px-2 py-0.5 shrink-0 ${STATUS_COLORS[inc.status] ?? 'bg-gray-100 text-gray-600'}`}>
{STATUS_LABELS[inc.status] ?? inc.status}
</span>
<span className="shrink-0"><StatusTag status={inc.status}>{STATUS_LABELS[inc.status] ?? inc.status}</StatusTag></span>
</div>
</Link>
))}