refactor(design): drop rounded classes, swap bg-white and gray borders for tokens

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-30 19:02:28 +08:00
co-authored by Claude Haiku 4.5
parent 8701d24c6c
commit 3a941a357b
51 changed files with 394 additions and 285 deletions
+5 -5
View File
@@ -72,7 +72,7 @@ export function CapaBoard({ capas }: Props) {
<th className="pb-2">Status</th>
</tr>
</thead>
<tbody className="divide-y divide-gray-100">
<tbody className="divide-y divide-divider">
{capas.map(c => (
<tr key={c.id}>
<td className="py-2 pr-4 text-gray-500 text-xs">
@@ -86,7 +86,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 rounded text-xs font-medium ${PRIORITY_BADGE[c.priority]}`}>
<span className={`px-2 py-0.5 text-xs font-medium ${PRIORITY_BADGE[c.priority]}`}>
{c.priority}
</span>
</td>
@@ -107,18 +107,18 @@ export function CapaBoard({ capas }: Props) {
</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={`rounded-xl border p-4 ${STATUS_COLORS[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">
{STATUS_LABELS[status]} ({byStatus[status].length})
</h3>
<div className="space-y-2 max-h-96 overflow-y-auto pr-2">
{byStatus[status].map(c => (
<Link key={c.id} href={`/hse/capa/${c.id}`}
className="block bg-white rounded-lg p-3 shadow-sm hover:shadow-md transition-shadow border border-gray-100">
className="block bg-surface p-3 shadow-sm hover:shadow-md transition-shadow border border-divider">
<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 rounded ${PRIORITY_BADGE[c.priority]}`}>{c.priority}</span>
<span className={`px-1.5 py-0.5 ${PRIORITY_BADGE[c.priority]}`}>{c.priority}</span>
</div>
<p className="text-xs text-gray-400 mt-1">Due {c.due_date}</p>
</Link>
+6 -6
View File
@@ -77,7 +77,7 @@ export function CapaForm({ incidentId }: Props) {
value={description}
onChange={e => setDescription(e.target.value)}
rows={3} required
className="w-full rounded-lg border border-gray-300 px-3 py-2 text-sm"
className="w-full border border-divider px-3 py-2 text-sm"
placeholder="What corrective action will be taken?"
/>
</div>
@@ -86,14 +86,14 @@ export function CapaForm({ incidentId }: Props) {
<label className="block text-sm font-medium text-gray-700 mb-1">Root Cause Reference</label>
<input type="text" value={rootCauseRef}
onChange={e => setRootCauseRef(e.target.value)}
className="w-full rounded-lg border border-gray-300 px-3 py-2 text-sm"
className="w-full border border-divider px-3 py-2 text-sm"
placeholder="e.g. Why #3 — inadequate training" />
</div>
<div>
<label className="block text-sm font-medium text-gray-700 mb-1">Assigned To *</label>
<select value={ownerId} onChange={e => handleOwnerChange(e.target.value)} required
className="w-full rounded-lg border border-gray-300 px-3 py-2 text-sm">
className="w-full border border-divider px-3 py-2 text-sm">
<option value="">Select owner…</option>
{users.map(u => (
<option key={u.id} value={u.id}>{u.name} ({u.department})</option>
@@ -105,12 +105,12 @@ export function CapaForm({ incidentId }: Props) {
<div>
<label className="block text-sm font-medium text-gray-700 mb-1">Due Date *</label>
<input type="date" value={dueDate} onChange={e => setDueDate(e.target.value)} required
className="w-full rounded-lg border border-gray-300 px-3 py-2 text-sm" />
className="w-full border border-divider px-3 py-2 text-sm" />
</div>
<div>
<label className="block text-sm font-medium text-gray-700 mb-1">Priority</label>
<select value={priority} onChange={e => setPriority(e.target.value as 'low' | 'med' | 'high')}
className="w-full rounded-lg border border-gray-300 px-3 py-2 text-sm">
className="w-full border border-divider px-3 py-2 text-sm">
<option value="low">Low</option>
<option value="med">Medium</option>
<option value="high">High</option>
@@ -121,7 +121,7 @@ export function CapaForm({ incidentId }: Props) {
{error && <p className="text-sm text-red-600">{error}</p>}
<button type="submit" disabled={saving}
className="w-full bg-amber-600 text-white rounded-lg py-2 text-sm font-semibold disabled:opacity-50">
className="w-full bg-amber-600 text-white py-2 text-sm font-semibold disabled:opacity-50">
{saving ? 'Creating…' : 'Create CAPA Action'}
</button>
</form>
+2 -2
View File
@@ -36,7 +36,7 @@ export function CapaOwnerActions({ capaId, currentStatus }: Props) {
<button
onClick={() => updateStatus('in_progress')}
disabled={loading}
className="text-sm px-3 py-1.5 border border-gray-300 rounded-md hover:bg-gray-50 disabled:opacity-50"
className="text-sm px-3 py-1.5 border border-divider hover:bg-gray-50 disabled:opacity-50"
>
{loading ? '…' : 'Mark In Progress'}
</button>
@@ -48,7 +48,7 @@ export function CapaOwnerActions({ capaId, currentStatus }: Props) {
<button
onClick={() => updateStatus('pending_verification')}
disabled={loading}
className="text-sm px-3 py-1.5 bg-blue-600 text-white rounded-md hover:bg-blue-700 disabled:opacity-50"
className="text-sm px-3 py-1.5 bg-blue-600 text-white hover:bg-blue-700 disabled:opacity-50"
>
{loading ? '…' : 'Submit for Verification'}
</button>
+2 -2
View File
@@ -39,14 +39,14 @@ export function CapaOwnerNotesForm({ capaId, initialNotes }: Props) {
onChange={e => { setNotes(e.target.value); setSaved(false) }}
rows={2}
placeholder="Add any notes or updates for this action…"
className="w-full rounded-md border border-gray-200 px-3 py-2 text-sm text-gray-800 resize-none focus:outline-none focus:ring-2 focus:ring-blue-500"
className="w-full border border-divider px-3 py-2 text-sm text-gray-800 resize-none focus:outline-none focus:ring-2 focus:ring-blue-500"
/>
{error && <p className="text-xs text-red-600">{error}</p>}
<div className="flex items-center gap-2">
<button
onClick={handleSave}
disabled={saving}
className="text-xs px-3 py-1 bg-gray-800 text-white rounded-md hover:bg-gray-700 disabled:opacity-50"
className="text-xs px-3 py-1 bg-gray-800 text-white hover:bg-gray-700 disabled:opacity-50"
>
{saving ? 'Saving…' : 'Save Notes'}
</button>
+2 -2
View File
@@ -31,7 +31,7 @@ export function CloseCapaButton({ capaId }: Props) {
}
return (
<div className="border border-gray-200 rounded-xl p-5 space-y-3 bg-green-50">
<div className="border border-divider p-5 space-y-3 bg-green-50">
<h3 className="text-sm font-semibold text-gray-800">Close CAPA</h3>
<p className="text-sm text-gray-600">
This CAPA has been verified as effective. Close it to mark it fully resolved.
@@ -40,7 +40,7 @@ export function CloseCapaButton({ capaId }: Props) {
<button
onClick={handleClose}
disabled={loading}
className="w-full bg-green-700 text-white rounded-lg py-2 text-sm font-semibold hover:bg-green-800 disabled:opacity-50"
className="w-full bg-green-700 text-white py-2 text-sm font-semibold hover:bg-green-800 disabled:opacity-50"
>
{loading ? 'Closing…' : 'Close CAPA'}
</button>
+13 -13
View File
@@ -39,28 +39,28 @@ export function VerifyForm({ capaId }: Props) {
}
return (
<form onSubmit={handleSubmit} className="border border-gray-200 rounded-xl p-5 space-y-4 bg-purple-50">
<form onSubmit={handleSubmit} className="border border-divider p-5 space-y-4 bg-purple-50">
<h3 className="text-sm font-semibold text-gray-800">HSE Verification</h3>
<div className="flex gap-3">
<button
type="button"
onClick={() => setVerdict('verified')}
className={`flex-1 py-2 rounded-lg text-sm font-medium border ${
verdict === 'verified'
? 'bg-green-600 text-white border-green-600'
: 'bg-white text-gray-700 border-gray-300 hover:border-green-500'
}`}
className={`flex-1 py-2 text-sm font-medium border ${
verdict === 'verified'
? 'bg-green-600 text-white border-green-600'
: 'bg-surface text-gray-700 border-divider hover:border-green-500'
}`}
>
Verified — Effective
</button>
<button
type="button"
onClick={() => setVerdict('reopened')}
className={`flex-1 py-2 rounded-lg text-sm font-medium border ${
verdict === 'reopened'
? 'bg-orange-600 text-white border-orange-600'
: 'bg-white text-gray-700 border-gray-300 hover:border-orange-500'
}`}
className={`flex-1 py-2 text-sm font-medium border ${
verdict === 'reopened'
? 'bg-orange-600 text-white border-orange-600'
: 'bg-surface text-gray-700 border-divider hover:border-orange-500'
}`}
>
Reopen — Ineffective
</button>
@@ -72,7 +72,7 @@ export function VerifyForm({ capaId }: Props) {
value={reopenReason}
onChange={e => setReopenReason(e.target.value)}
rows={2} required
className="w-full rounded-lg border border-gray-300 px-3 py-2 text-sm"
className="w-full border border-divider px-3 py-2 text-sm"
placeholder="Describe why the corrective action did not resolve the root cause…"
/>
</div>
@@ -80,7 +80,7 @@ export function VerifyForm({ capaId }: Props) {
{error && <p className="text-sm text-red-600">{error}</p>}
{verdict && (
<button type="submit" disabled={saving}
className="w-full bg-gray-900 text-white rounded-lg py-2 text-sm font-semibold disabled:opacity-50">
className="w-full bg-gray-900 text-white py-2 text-sm font-semibold disabled:opacity-50">
{saving ? 'Saving…' : 'Submit Verification'}
</button>
)}