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:
@@ -9,6 +9,7 @@ import { eq, asc } from 'drizzle-orm'
|
||||
import { StatCard } from '@/components/dashboard/stat-card'
|
||||
import { CapaOwnerActions } from '@/components/capa/capa-owner-actions'
|
||||
import { CapaOwnerNotesForm } from '@/components/capa/capa-owner-notes-form'
|
||||
import { StatusTag } from '@/components/ui/status-tag'
|
||||
|
||||
const STATUS_LABELS: Record<string, string> = {
|
||||
open: 'Open',
|
||||
@@ -20,16 +21,6 @@ const STATUS_LABELS: Record<string, string> = {
|
||||
closed: 'Closed',
|
||||
}
|
||||
|
||||
const STATUS_COLORS: Record<string, string> = {
|
||||
open: 'bg-gray-100 text-gray-700',
|
||||
in_progress: 'bg-blue-100 text-blue-700',
|
||||
overdue: 'bg-red-100 text-red-700',
|
||||
pending_verification: 'bg-purple-100 text-purple-700',
|
||||
verified: 'bg-green-100 text-green-700',
|
||||
reopened: 'bg-orange-100 text-orange-700',
|
||||
closed: 'bg-gray-100 text-gray-500',
|
||||
}
|
||||
|
||||
export default async function CapaOwnerPage() {
|
||||
const session = await getSession()
|
||||
if (!session) redirect('/login')
|
||||
@@ -63,9 +54,9 @@ export default async function CapaOwnerPage() {
|
||||
const doneCount = rows.filter(c => ['verified', 'closed'].includes(c.status)).length
|
||||
|
||||
const PRIORITY_COLORS: Record<string, string> = {
|
||||
high: 'text-red-600 font-semibold',
|
||||
med: 'text-orange-500 font-medium',
|
||||
low: 'text-gray-400',
|
||||
high: 'text-accent-700 font-extrabold',
|
||||
med: 'text-accent-700 font-medium',
|
||||
low: 'text-ink/50',
|
||||
}
|
||||
|
||||
const activeRows = rows.filter(c => !['verified', 'closed'].includes(c.status))
|
||||
@@ -101,9 +92,7 @@ export default async function CapaOwnerPage() {
|
||||
)}
|
||||
</div>
|
||||
<div className="shrink-0 text-right space-y-1">
|
||||
<span className={`text-xs rounded-full px-2 py-0.5 ${STATUS_COLORS[capa.status] ?? 'bg-gray-100 text-gray-600'}`}>
|
||||
{STATUS_LABELS[capa.status] ?? capa.status}
|
||||
</span>
|
||||
<StatusTag status={capa.status}>{STATUS_LABELS[capa.status] ?? capa.status}</StatusTag>
|
||||
<p className={`text-xs ${isOverdue ? 'text-red-600 font-semibold' : 'text-gray-400'}`}>
|
||||
{capa.dueDate ? `Due ${new Date(capa.dueDate).toLocaleDateString('en-MY')}` : 'No due date'}
|
||||
</p>
|
||||
@@ -131,9 +120,7 @@ export default async function CapaOwnerPage() {
|
||||
{doneRows.map(capa => (
|
||||
<div key={capa.id} className="p-4 flex items-center justify-between">
|
||||
<p className="text-sm text-gray-500 line-clamp-1">{capa.description}</p>
|
||||
<span className={`text-xs rounded-full px-2 py-0.5 ml-4 shrink-0 ${STATUS_COLORS[capa.status] ?? 'bg-gray-100'}`}>
|
||||
{STATUS_LABELS[capa.status] ?? capa.status}
|
||||
</span>
|
||||
<span className="shrink-0"><StatusTag status={capa.status}>{STATUS_LABELS[capa.status] ?? capa.status}</StatusTag></span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user