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
+14 -20
View File
@@ -2,6 +2,7 @@
import { useState } from 'react'
import Link from 'next/link'
import { PriorityTag } from '@/components/ui/status-tag'
type CapaStatus = 'open' | 'in_progress' | 'overdue' | 'pending_verification' | 'verified' | 'reopened' | 'closed'
@@ -27,19 +28,14 @@ const STATUS_LABELS: Record<CapaStatus, string> = {
reopened: 'Reopened',
closed: 'Closed',
}
const STATUS_COLORS: Record<CapaStatus, string> = {
open: 'bg-blue-50 border-blue-200',
in_progress: 'bg-yellow-50 border-yellow-200',
overdue: 'bg-red-50 border-red-200',
pending_verification: 'bg-purple-50 border-purple-200',
verified: 'bg-green-50 border-green-200',
reopened: 'bg-orange-50 border-orange-200',
closed: 'bg-gray-50 border-gray-200',
}
const PRIORITY_BADGE: Record<'low' | 'med' | 'high', string> = {
low: 'bg-gray-100 text-gray-600',
med: 'bg-yellow-100 text-yellow-700',
high: 'bg-red-100 text-red-700',
const COLUMN_BORDER: Record<CapaStatus, string> = {
open: 'border-divider',
in_progress: 'border-divider',
overdue: 'border-accent',
pending_verification: 'border-divider',
verified: 'border-divider',
reopened: 'border-accent',
closed: 'border-divider',
}
interface Props {
@@ -86,9 +82,7 @@ export function CapaBoard({ capas }: Props) {
<td className="py-2 pr-4 text-gray-600">{(c.owner as { name: string } | null)?.name ?? '—'}</td>
<td className="py-2 pr-4 text-gray-600">{c.due_date}</td>
<td className="py-2 pr-4">
<span className={`px-2 py-0.5 text-xs font-medium ${PRIORITY_BADGE[c.priority]}`}>
{c.priority}
</span>
<PriorityTag priority={c.priority} />
</td>
<td className="py-2 text-gray-600 text-xs">{STATUS_LABELS[c.status]}</td>
</tr>
@@ -103,12 +97,12 @@ export function CapaBoard({ capas }: Props) {
return (
<div>
<div className="flex justify-end mb-3">
<button onClick={() => setView('table')} className="text-sm text-blue-600 hover:underline">Table view</button>
<button onClick={() => setView('table')} className="text-sm text-accent-700 hover:underline">Table view</button>
</div>
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
{STATUS_ORDER.filter(s => s !== 'reopened').map(status => (
<div key={status} className={`border p-4 ${STATUS_COLORS[status]}`}>
<h3 className="text-xs font-semibold uppercase tracking-wide text-gray-600 mb-3">
<div key={status} className={`border-2 p-4 bg-ground ${COLUMN_BORDER[status]}`}>
<h3 className="text-xs font-extrabold uppercase tracking-wide text-ink/70 mb-3 pb-2 border-b-2 border-divider">
{STATUS_LABELS[status]} ({byStatus[status].length})
</h3>
<div className="space-y-2 max-h-96 overflow-y-auto pr-2">
@@ -118,7 +112,7 @@ export function CapaBoard({ capas }: Props) {
<p className="text-sm text-gray-800 line-clamp-2 mb-1">{c.description}</p>
<div className="flex items-center justify-between text-xs text-gray-500">
<span>{(c.owner as { name: string } | null)?.name ?? '—'}</span>
<span className={`px-1.5 py-0.5 ${PRIORITY_BADGE[c.priority]}`}>{c.priority}</span>
<PriorityTag priority={c.priority} />
</div>
<p className="text-xs text-gray-400 mt-1">Due {c.due_date}</p>
</Link>