feat(design): sweep off-system styles and add the check:design gate

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-30 20:39:44 +08:00
co-authored by Claude Haiku 4.5
parent ba9eeefe47
commit c5a98eed06
56 changed files with 335 additions and 216 deletions
+1 -1
View File
@@ -78,7 +78,7 @@ export function ClosurePanel({ incidentId, status, canClose, canAddAddenda }: Pr
<button
onClick={closeIncident}
disabled={busy}
className="bg-green-700 text-white px-4 py-2 text-sm font-semibold hover:bg-green-800 disabled:opacity-50"
className="bg-accent text-white px-4 py-2 text-sm font-semibold hover:bg-accent-700 disabled:opacity-50"
>
{busy ? 'Closing…' : 'Close Incident'}
</button>
+2 -2
View File
@@ -58,8 +58,8 @@ export function FileUpload({ onFilesChange, disabled = false }: Props) {
<div className="space-y-2">
<div
className={`border-2 border-dashed p-6 text-center cursor-pointer transition-colors
${dragging ? 'border-blue-500 bg-blue-50' : 'border-divider hover:border-gray-400'}
${disabled ? 'opacity-50 pointer-events-none' : ''}`}
${dragging ? 'border-accent bg-accent-100' : 'border-divider hover:border-gray-400'}
${disabled ? 'opacity-50 pointer-events-none' : ''}`}
onClick={() => inputRef.current?.click()}
onDragOver={e => { e.preventDefault(); setDragging(true) }}
onDragLeave={() => setDragging(false)}
+5 -5
View File
@@ -77,20 +77,20 @@ function FiltersInner({ sites, trucks }: FiltersProps) {
placeholder="Search reference or description..."
value={search}
onChange={e => handleSearch(e.target.value)}
className="w-full pl-8 pr-3 py-1.5 text-sm border border-divider focus:outline-none focus:ring-2 focus:ring-blue-500"
className="w-full pl-8 pr-3 py-1.5 text-sm border border-divider focus:outline-none focus:ring-2 focus:ring-accent"
/>
</div>
<select
value={searchParams.get('status') ?? ''}
onChange={e => updateParam('status', e.target.value)}
className="text-sm border border-divider px-2 py-1.5 focus:outline-none focus:ring-2 focus:ring-blue-500 bg-surface"
className="text-sm border border-divider px-2 py-1.5 focus:outline-none focus:ring-2 focus:ring-accent bg-surface"
>
{STATUS_OPTIONS.map(o => <option key={o.value} value={o.value}>{o.label}</option>)}
</select>
<select
value={searchParams.get('type') ?? ''}
onChange={e => updateParam('type', e.target.value)}
className="text-sm border border-divider px-2 py-1.5 focus:outline-none focus:ring-2 focus:ring-blue-500 bg-surface"
className="text-sm border border-divider px-2 py-1.5 focus:outline-none focus:ring-2 focus:ring-accent bg-surface"
>
{TYPE_OPTIONS.map(o => <option key={o.value} value={o.value}>{o.label}</option>)}
</select>
@@ -98,7 +98,7 @@ function FiltersInner({ sites, trucks }: FiltersProps) {
<select
value={searchParams.get('site_id') ?? ''}
onChange={e => updateParam('site_id', e.target.value)}
className="text-sm border border-divider px-2 py-1.5 focus:outline-none focus:ring-2 focus:ring-blue-500 bg-surface"
className="text-sm border border-divider px-2 py-1.5 focus:outline-none focus:ring-2 focus:ring-accent bg-surface"
>
<option value="">All Sites</option>
{sites.map(s => <option key={s.id} value={s.id}>{s.name}</option>)}
@@ -108,7 +108,7 @@ function FiltersInner({ sites, trucks }: FiltersProps) {
<select
value={searchParams.get('truck_id') ?? ''}
onChange={e => updateParam('truck_id', e.target.value)}
className="text-sm border border-divider px-2 py-1.5 focus:outline-none focus:ring-2 focus:ring-blue-500 bg-surface"
className="text-sm border border-divider px-2 py-1.5 focus:outline-none focus:ring-2 focus:ring-accent bg-surface"
>
<option value="">All Trucks</option>
{trucks.map(tk => <option key={tk.id} value={tk.id}>{tk.truck_no}</option>)}
+3 -3
View File
@@ -43,7 +43,7 @@ export function IncidentHeader({
{canTriage && (
<Link
href={`/hse/incidents/${incidentId}/triage`}
className="text-xs px-3 py-1.5 bg-blue-600 text-white font-medium hover:bg-blue-700"
className="text-xs px-3 py-1.5 bg-accent text-white font-medium hover:bg-accent-600"
>
Triage
</Link>
@@ -51,7 +51,7 @@ export function IncidentHeader({
{canInvestigate && (
<Link
href={`/hse/incidents/${incidentId}/investigation`}
className="text-xs px-3 py-1.5 bg-indigo-600 text-white font-medium hover:bg-indigo-700"
className="text-xs px-3 py-1.5 bg-accent text-white font-medium hover:bg-accent-600"
>
Investigate
</Link>
@@ -59,7 +59,7 @@ export function IncidentHeader({
{canAddCapa && (
<Link
href={`/hse/incidents/${incidentId}/capa/new`}
className="text-xs px-3 py-1.5 bg-amber-600 text-white font-medium hover:bg-amber-700"
className="text-xs px-3 py-1.5 bg-accent text-white font-medium hover:bg-accent-600"
>
Add CAPA
</Link>
+3 -3
View File
@@ -60,12 +60,12 @@ export function IncidentList({ incidents, basePath }: Props) {
<input
type="search"
placeholder="Search ref, type, site…"
className="border border-divider px-3 py-2 text-sm w-48 focus:outline-none focus:ring-2 focus:ring-blue-500"
className="border border-divider px-3 py-2 text-sm w-48 focus:outline-none focus:ring-2 focus:ring-accent"
value={search}
onChange={e => setSearch(e.target.value)}
/>
<select
className="border border-divider px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"
className="border border-divider px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-accent"
value={typeFilter}
onChange={e => setTypeFilter(e.target.value)}
>
@@ -75,7 +75,7 @@ export function IncidentList({ incidents, basePath }: Props) {
))}
</select>
<select
className="border border-divider px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"
className="border border-divider px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-accent"
value={statusFilter}
onChange={e => setStatusFilter(e.target.value)}
>
+10 -10
View File
@@ -136,7 +136,7 @@ export function InvestigationForm({ incidentId, existingInvestigationId }: Props
type="button"
onClick={getAiDraft}
disabled={aiDraftLoading}
className="bg-purple-50 text-purple-700 border border-purple-300 px-3 py-1.5 text-xs font-semibold disabled:opacity-50 hover:bg-purple-100"
className="bg-accent-100 text-accent-700 border border-accent-300 px-3 py-1.5 text-xs font-semibold disabled:opacity-50 hover:bg-accent-200"
>
{aiDraftLoading ? 'Drafting…' : 'Get AI Draft'}
</button>
@@ -149,10 +149,10 @@ export function InvestigationForm({ incidentId, existingInvestigationId }: Props
key={m} type="button"
onClick={() => setMethod(m)}
className={`px-3 py-1.5 text-sm font-medium border ${
method === m
? 'bg-blue-600 text-white border-blue-600'
: 'bg-surface text-gray-700 border-divider hover:border-blue-400'
}`}
method === m
? 'bg-accent text-white border-accent'
: 'bg-surface text-gray-700 border-divider hover:border-accent'
}`}
>
{m === 'five_why' ? '5-Why' : m === 'fishbone' ? 'Fishbone' : 'Other'}
</button>
@@ -182,7 +182,7 @@ export function InvestigationForm({ incidentId, existingInvestigationId }: Props
))}
{fiveWhy.length < 5 && (
<button type="button" onClick={addWhyStep}
className="text-sm text-blue-600 hover:underline">
className="text-sm text-accent-700 hover:underline">
+ Add another Why
</button>
)}
@@ -205,7 +205,7 @@ export function InvestigationForm({ incidentId, existingInvestigationId }: Props
/>
))}
<button type="button" onClick={() => addFishboneCause(catIdx)}
className="text-xs text-blue-600 hover:underline">
className="text-xs text-accent-700 hover:underline">
+ Add cause
</button>
</div>
@@ -262,7 +262,7 @@ export function InvestigationForm({ incidentId, existingInvestigationId }: Props
<button
type="button"
onClick={() => setWitnessRefs([...witnessRefs, ''])}
className="text-xs text-blue-600 hover:underline"
className="text-xs text-accent-700 hover:underline"
>
+ Add witness statement
</button>
@@ -293,7 +293,7 @@ export function InvestigationForm({ incidentId, existingInvestigationId }: Props
{!existingInvestigationId && (
<label className="flex items-center gap-2 text-sm text-gray-700">
<input type="checkbox" checked={complete} onChange={e => setComplete(e.target.checked)}
className="border-divider text-blue-600" />
className="border-divider text-accent-700" />
Mark investigation complete (transitions incident to CAPA Pending)
</label>
)}
@@ -301,7 +301,7 @@ export function InvestigationForm({ incidentId, existingInvestigationId }: Props
{error && <p className="text-sm text-red-600">{error}</p>}
<button type="submit" disabled={saving}
className="w-full bg-indigo-600 text-white py-2 text-sm font-semibold disabled:opacity-50">
className="w-full bg-accent text-white py-2 text-sm font-semibold disabled:opacity-50">
{saving ? 'Saving…' : existingInvestigationId ? 'Update Investigation' : 'Start Investigation'}
</button>
</form>
+6 -6
View File
@@ -40,11 +40,11 @@ export function InvestigationPanel({ investigation: inv }: Props) {
<h2 className="text-sm font-semibold text-gray-900">Investigation</h2>
<div className="flex items-center gap-2">
<span className="text-xs text-gray-500">{METHOD_LABELS[inv.method] ?? inv.method}</span>
<span className={`text-xs font-medium px-2 py-0.5 rounded-full ${
inv.completed_at
? 'bg-green-100 text-green-700'
: 'bg-yellow-100 text-yellow-700'
}`}>
<span className={`text-xs font-medium px-2 py-0.5 ${
inv.completed_at
? 'bg-neutral-100 text-ink'
: 'bg-accent-100 text-accent-700'
}`}>
{inv.completed_at ? 'Completed' : 'In Progress'}
</span>
</div>
@@ -67,7 +67,7 @@ export function InvestigationPanel({ investigation: inv }: Props) {
<ol className="space-y-3">
{inv.five_why_steps.map((step, i) => (
<li key={i} className="flex gap-3">
<span className="flex-shrink-0 w-6 h-6 rounded-full bg-blue-100 text-blue-700 text-xs font-bold flex items-center justify-center">
<span className="flex-shrink-0 w-6 h-6 bg-accent-100 text-accent-700 text-xs font-bold flex items-center justify-center">
{i + 1}
</span>
<div className="flex-1 min-w-0">
+4 -4
View File
@@ -56,15 +56,15 @@ export function OfflineSync() {
if (pendingCount === 0) return null
return (
<div className="fixed bottom-4 left-4 right-4 bg-yellow-50 border border-yellow-300 p-3 flex items-center justify-between shadow-md z-50">
<span className="text-sm text-yellow-800 font-medium">
<div className="fixed bottom-4 left-4 right-4 bg-accent-100 border border-accent-300 p-3 flex items-center justify-between shadow-md z-50">
<span className="text-sm text-accent-700 font-medium">
{pendingCount} report{pendingCount > 1 ? 's' : ''} saved offline
</span>
<button
onClick={syncNow}
disabled={syncing || !navigator.onLine}
className="text-xs bg-yellow-600 text-white px-3 py-1.5 font-medium
hover:bg-yellow-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors"
className="text-xs bg-accent text-white px-3 py-1.5 font-medium
hover:bg-accent-600 disabled:opacity-50 disabled:cursor-not-allowed transition-colors"
>
{syncing ? 'Syncing…' : 'Sync now'}
</button>
+1 -1
View File
@@ -15,7 +15,7 @@ export function Pagination({ page, pageSize, total, href }: Props) {
disabled ? (
<span className="px-3 py-1.5 text-sm text-gray-300">{label}</span>
) : (
<Link href={`${href}?page=${p}`} className="px-3 py-1.5 text-sm text-blue-600 hover:underline">
<Link href={`${href}?page=${p}`} className="px-3 py-1.5 text-sm text-accent-700 hover:underline">
{label}
</Link>
)
+18 -18
View File
@@ -73,7 +73,7 @@ export function ReportForm({ zoneToken, trucks, initialTruckId }: Props) {
value={(typeDetails[key] as string) ?? ''}
onChange={e => setDetail(key, e.target.value)}
placeholder={placeholder}
className="w-full border border-divider px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"
className="w-full border border-divider px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-accent"
/>
</div>
)
@@ -82,7 +82,7 @@ export function ReportForm({ zoneToken, trucks, initialTruckId }: Props) {
<label className="flex items-center gap-3 cursor-pointer">
<input
type="checkbox"
className="w-4 h-4 text-blue-600"
className="w-4 h-4 text-accent-700"
checked={Boolean(typeDetails[key])}
onChange={e => setDetail(key, e.target.checked)}
/>
@@ -205,7 +205,7 @@ export function ReportForm({ zoneToken, trucks, initialTruckId }: Props) {
if (savedOffline) {
return (
<div className="bg-green-50 border border-green-200 p-5 text-sm text-green-700">
<div className="bg-neutral-100 border border-divider p-5 text-sm text-ink">
{t.savedOffline}
</div>
)
@@ -214,7 +214,7 @@ export function ReportForm({ zoneToken, trucks, initialTruckId }: Props) {
return (
<form onSubmit={handleSubmit} className="space-y-5 bg-surface shadow-sm p-5">
{!isOnline && (
<div className="bg-yellow-50 border border-yellow-200 p-3 text-sm text-yellow-700">
<div className="bg-accent-100 border border-accent-300 p-3 text-sm text-accent-700">
{t.offlineBanner}
</div>
)}
@@ -231,7 +231,7 @@ export function ReportForm({ zoneToken, trucks, initialTruckId }: Props) {
</label>
<select
required
className="w-full border border-divider px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"
className="w-full border border-divider px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-accent"
value={form.incident_type}
onChange={e => {
setForm(f => ({ ...f, incident_type: e.target.value as IncidentType, truck_id: '' }))
@@ -278,7 +278,7 @@ export function ReportForm({ zoneToken, trucks, initialTruckId }: Props) {
</label>
<select
required
className="w-full border border-divider px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"
className="w-full border border-divider px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-accent"
value={form.truck_id}
onChange={e => setForm(f => ({ ...f, truck_id: e.target.value }))}
>
@@ -301,31 +301,31 @@ export function ReportForm({ zoneToken, trucks, initialTruckId }: Props) {
minLength={10}
rows={4}
placeholder={t.descriptionPlaceholder}
className="w-full border border-divider px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 resize-none"
className="w-full border border-divider px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-accent resize-none"
value={form.description}
onChange={e => setForm(f => ({ ...f, description: e.target.value }))}
/>
</div>
{qualityCheck && !qualityCheck.passes && (
<div className="bg-amber-50 border border-amber-200 p-3 space-y-2">
<p className="text-xs font-semibold text-amber-700 uppercase tracking-wide">
<div className="bg-accent-100 border border-accent-300 p-3 space-y-2">
<p className="text-xs font-semibold text-accent-700 uppercase tracking-wide">
{t.qualityScoreLabel.replace('{score}', String(qualityCheck.score))}
</p>
<p className="text-sm text-amber-800">{qualityCheck.feedback}</p>
<p className="text-sm text-accent-700">{qualityCheck.feedback}</p>
{qualityCheck.suggestions.length > 0 && (
<ul className="list-disc list-inside space-y-1">
{qualityCheck.suggestions.map((s, i) => (
<li key={i} className="text-xs text-amber-700">{s}</li>
<li key={i} className="text-xs text-accent-700">{s}</li>
))}
</ul>
)}
<label className="flex items-center gap-2 text-xs text-amber-700 cursor-pointer mt-1">
<label className="flex items-center gap-2 text-xs text-accent-700 cursor-pointer mt-1">
<input
type="checkbox"
checked={overrideQuality}
onChange={e => setOverrideQuality(e.target.checked)}
className="border-amber-300 text-amber-600"
className="border-accent-300 text-accent-700"
/>
{t.submitAnyway}
</label>
@@ -336,7 +336,7 @@ export function ReportForm({ zoneToken, trucks, initialTruckId }: Props) {
<label className="flex items-center gap-3 cursor-pointer">
<input
type="checkbox"
className="w-4 h-4 text-blue-600"
className="w-4 h-4 text-accent-700"
checked={form.injury_involved}
onChange={e => setForm(f => ({ ...f, injury_involved: e.target.checked, medical_status: '' }))}
/>
@@ -350,7 +350,7 @@ export function ReportForm({ zoneToken, trucks, initialTruckId }: Props) {
</label>
<select
required={form.injury_involved}
className="w-full border border-divider px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"
className="w-full border border-divider px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-accent"
value={form.medical_status}
onChange={e => setForm(f => ({ ...f, medical_status: e.target.value as MedicalStatus }))}
>
@@ -365,7 +365,7 @@ export function ReportForm({ zoneToken, trucks, initialTruckId }: Props) {
<label className="flex items-center gap-3 cursor-pointer">
<input
type="checkbox"
className="w-4 h-4 text-blue-600"
className="w-4 h-4 text-accent-700"
checked={form.asset_involved}
onChange={e => setForm(f => ({ ...f, asset_involved: e.target.checked }))}
/>
@@ -383,8 +383,8 @@ export function ReportForm({ zoneToken, trucks, initialTruckId }: Props) {
<button
type="submit"
disabled={submitting || !form.incident_type || (form.incident_type === 'transport' && !form.truck_id)}
className="w-full bg-blue-600 text-white py-3 font-medium text-sm
hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors"
className="w-full bg-accent text-white py-3 font-medium text-sm
hover:bg-accent-600 disabled:opacity-50 disabled:cursor-not-allowed transition-colors"
>
{submitting ? t.submitting : t.submitButton}
</button>
@@ -60,7 +60,7 @@ export function SimilarIncidentsPanel({ incidentId }: Props) {
<a
key={inc.id}
href={`/hse/incidents/${inc.id}`}
className="block border border-divider p-3 hover:border-blue-300 hover:bg-blue-50 transition-colors"
className="block border border-divider p-3 hover:border-accent hover:bg-neutral-100 transition-colors"
>
<div className="flex items-center justify-between mb-1">
<span className="text-xs font-medium text-gray-500">
+12 -12
View File
@@ -102,10 +102,10 @@ export function TriageForm({ incidentId, currentSeverity }: Props) {
type="button"
onClick={() => setSeverity(v)}
className={`flex-1 py-2 text-xs font-medium transition-colors ${
severity === v
? 'bg-blue-600 text-white border-blue-600'
: 'bg-surface text-gray-700 hover:bg-gray-50'
}`}
severity === v
? 'bg-accent text-white border-accent'
: 'bg-surface text-gray-700 hover:bg-gray-50'
}`}
>
<span className="block font-bold">{v}</span>
<span className="block">{SEVERITY_LABELS[v].split(' / ')[0]}</span>
@@ -126,7 +126,7 @@ export function TriageForm({ incidentId, currentSeverity }: Props) {
<input
type="checkbox" checked={value}
onChange={e => set(e.target.checked)}
className="border-divider text-blue-600"
className="border-divider text-accent-700"
/>
{label}
</label>
@@ -151,16 +151,16 @@ export function TriageForm({ incidentId, currentSeverity }: Props) {
value={triageNotes}
onChange={e => setTriageNotes(e.target.value)}
rows={3}
className="w-full border border-divider px-3 py-2 text-sm focus:ring-2 focus:ring-blue-500 focus:border-transparent"
className="w-full border border-divider px-3 py-2 text-sm focus:ring-2 focus:ring-accent focus:border-transparent"
placeholder="Initial assessment, immediate actions taken..."
/>
</div>
{aiRationale && (
<div className="bg-purple-50 border border-purple-200 p-3">
<p className="text-xs font-semibold text-purple-700 mb-1">AI Suggestion Rationale</p>
<p className="text-xs text-purple-600">{aiRationale}</p>
<p className="text-xs text-purple-400 mt-1">Fields pre-filled — review before submitting.</p>
<div className="bg-accent-100 border border-accent-300 p-3">
<p className="text-xs font-semibold text-accent-700 mb-1">AI Suggestion Rationale</p>
<p className="text-xs text-accent-700">{aiRationale}</p>
<p className="text-xs text-accent-400 mt-1">Fields pre-filled — review before submitting.</p>
</div>
)}
@@ -171,14 +171,14 @@ export function TriageForm({ incidentId, currentSeverity }: Props) {
type="button"
onClick={getAiSuggestion}
disabled={aiLoading || saving}
className="flex-1 bg-purple-50 text-purple-700 border border-purple-300 py-2 text-sm font-semibold disabled:opacity-50 hover:bg-purple-100"
className="flex-1 bg-accent-100 text-accent-700 border border-accent-300 py-2 text-sm font-semibold disabled:opacity-50 hover:bg-accent-200"
>
{aiLoading ? 'Getting suggestion…' : 'Get AI Suggestion'}
</button>
<button
type="submit"
disabled={saving}
className="flex-1 bg-blue-600 text-white py-2 text-sm font-semibold disabled:opacity-50"
className="flex-1 bg-accent text-white py-2 text-sm font-semibold disabled:opacity-50"
>
{saving ? 'Saving…' : 'Complete Triage'}
</button>