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:
@@ -78,7 +78,7 @@ export function ClosurePanel({ incidentId, status, canClose, canAddAddenda }: Pr
|
||||
<button
|
||||
onClick={closeIncident}
|
||||
disabled={busy}
|
||||
className="bg-green-700 text-white rounded-lg px-4 py-2 text-sm font-semibold hover:bg-green-800 disabled:opacity-50"
|
||||
className="bg-green-700 text-white px-4 py-2 text-sm font-semibold hover:bg-green-800 disabled:opacity-50"
|
||||
>
|
||||
{busy ? 'Closing…' : 'Close Incident'}
|
||||
</button>
|
||||
@@ -89,7 +89,7 @@ export function ClosurePanel({ incidentId, status, canClose, canAddAddenda }: Pr
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="mt-6 bg-white rounded-xl shadow-sm p-5">
|
||||
<div className="mt-6 bg-surface shadow-sm p-5">
|
||||
<h2 className="text-sm font-semibold text-gray-700 uppercase tracking-wide mb-1">Addenda</h2>
|
||||
<p className="text-xs text-gray-400 mb-3">
|
||||
This incident is closed and locked. New information is recorded as addenda.
|
||||
@@ -99,7 +99,7 @@ export function ClosurePanel({ incidentId, status, canClose, canAddAddenda }: Pr
|
||||
) : (
|
||||
<ul className="space-y-3">
|
||||
{addenda.map(a => (
|
||||
<li key={a.id} className="border border-gray-100 rounded-lg p-3">
|
||||
<li key={a.id} className="border border-divider p-3">
|
||||
<p className="text-sm text-gray-800 whitespace-pre-wrap">{a.body}</p>
|
||||
<p className="text-xs text-gray-400 mt-1">
|
||||
{a.author?.name ?? 'Unknown'} · {new Date(a.created_at).toLocaleString('en-MY', { timeZone: 'Asia/Kuala_Lumpur' })}
|
||||
@@ -115,12 +115,12 @@ export function ClosurePanel({ incidentId, status, canClose, canAddAddenda }: Pr
|
||||
onChange={e => setDraft(e.target.value)}
|
||||
rows={3}
|
||||
placeholder="Add an addendum…"
|
||||
className="w-full border border-gray-200 rounded-lg p-2 text-sm"
|
||||
className="w-full border border-divider p-2 text-sm"
|
||||
/>
|
||||
<button
|
||||
onClick={addAddendum}
|
||||
disabled={busy || !draft.trim()}
|
||||
className="mt-2 bg-gray-800 text-white rounded-lg px-4 py-2 text-sm font-semibold hover:bg-gray-900 disabled:opacity-50"
|
||||
className="mt-2 bg-gray-800 text-white px-4 py-2 text-sm font-semibold hover:bg-gray-900 disabled:opacity-50"
|
||||
>
|
||||
{busy ? 'Saving…' : 'Add Addendum'}
|
||||
</button>
|
||||
|
||||
@@ -34,7 +34,7 @@ export function EvidenceGallery({ files, stage }: Props) {
|
||||
href={file.file_url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="block rounded-lg overflow-hidden bg-gray-100 aspect-square hover:opacity-90 transition-opacity"
|
||||
className="block overflow-hidden bg-gray-100 aspect-square hover:opacity-90 transition-opacity"
|
||||
>
|
||||
{isImage(file.file_type) ? (
|
||||
<img
|
||||
|
||||
@@ -57,9 +57,9 @@ export function FileUpload({ onFilesChange, disabled = false }: Props) {
|
||||
return (
|
||||
<div className="space-y-2">
|
||||
<div
|
||||
className={`border-2 border-dashed rounded-lg p-6 text-center cursor-pointer transition-colors
|
||||
${dragging ? 'border-blue-500 bg-blue-50' : 'border-gray-300 hover:border-gray-400'}
|
||||
${disabled ? 'opacity-50 pointer-events-none' : ''}`}
|
||||
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' : ''}`}
|
||||
onClick={() => inputRef.current?.click()}
|
||||
onDragOver={e => { e.preventDefault(); setDragging(true) }}
|
||||
onDragLeave={() => setDragging(false)}
|
||||
@@ -94,7 +94,7 @@ export function FileUpload({ onFilesChange, disabled = false }: Props) {
|
||||
{files.length > 0 && (
|
||||
<ul className="space-y-1">
|
||||
{files.map((f, i) => (
|
||||
<li key={i} className="flex items-center justify-between bg-gray-50 rounded px-3 py-2 text-sm">
|
||||
<li key={i} className="flex items-center justify-between bg-gray-50 px-3 py-2 text-sm">
|
||||
<span className="truncate max-w-xs">{f.name}</span>
|
||||
<button
|
||||
type="button"
|
||||
|
||||
@@ -72,7 +72,7 @@ export function IncidentDetail({ incident }: Props) {
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<div className="bg-white rounded-xl shadow-sm p-5">
|
||||
<div className="bg-surface shadow-sm p-5">
|
||||
<div className="flex items-start justify-between mb-4">
|
||||
<div>
|
||||
<h1 className="text-xl font-bold text-gray-900 font-mono">
|
||||
@@ -114,12 +114,12 @@ export function IncidentDetail({ incident }: Props) {
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<div className="bg-white rounded-xl shadow-sm p-5">
|
||||
<div className="bg-surface shadow-sm p-5">
|
||||
<h2 className="text-sm font-semibold text-gray-900 mb-2">Description</h2>
|
||||
<p className="text-sm text-gray-800 leading-relaxed whitespace-pre-wrap">{incident.description}</p>
|
||||
</div>
|
||||
|
||||
<div className="bg-white rounded-xl shadow-sm p-5">
|
||||
<div className="bg-surface shadow-sm p-5">
|
||||
<h2 className="text-sm font-semibold text-gray-900 mb-3">
|
||||
Evidence — Report Stage
|
||||
<span className="ml-2 text-gray-400 font-normal normal-case">
|
||||
|
||||
@@ -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-gray-300 rounded-lg 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-blue-500"
|
||||
/>
|
||||
</div>
|
||||
<select
|
||||
value={searchParams.get('status') ?? ''}
|
||||
onChange={e => updateParam('status', e.target.value)}
|
||||
className="text-sm border border-gray-300 rounded-lg px-2 py-1.5 focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white"
|
||||
className="text-sm border border-divider px-2 py-1.5 focus:outline-none focus:ring-2 focus:ring-blue-500 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-gray-300 rounded-lg px-2 py-1.5 focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white"
|
||||
className="text-sm border border-divider px-2 py-1.5 focus:outline-none focus:ring-2 focus:ring-blue-500 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-gray-300 rounded-lg px-2 py-1.5 focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white"
|
||||
className="text-sm border border-divider px-2 py-1.5 focus:outline-none focus:ring-2 focus:ring-blue-500 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-gray-300 rounded-lg px-2 py-1.5 focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white"
|
||||
className="text-sm border border-divider px-2 py-1.5 focus:outline-none focus:ring-2 focus:ring-blue-500 bg-surface"
|
||||
>
|
||||
<option value="">All Trucks</option>
|
||||
{trucks.map(tk => <option key={tk.id} value={tk.id}>{tk.truck_no}</option>)}
|
||||
|
||||
@@ -35,7 +35,7 @@ export function IncidentHeader({
|
||||
canTriage, canInvestigate, canAddCapa,
|
||||
}: Props) {
|
||||
return (
|
||||
<div className="sticky top-0 z-30 bg-white border-b border-gray-200 shadow-sm">
|
||||
<div className="sticky top-0 z-30 bg-surface border-b border-divider shadow-sm">
|
||||
<div className="max-w-3xl mx-auto px-4 py-3 flex items-center justify-between gap-4 flex-wrap">
|
||||
<div className="flex items-center gap-3 min-w-0">
|
||||
<Link href={backHref} className="text-sm text-gray-500 hover:text-gray-700 shrink-0">
|
||||
@@ -53,7 +53,7 @@ export function IncidentHeader({
|
||||
{canTriage && (
|
||||
<Link
|
||||
href={`/hse/incidents/${incidentId}/triage`}
|
||||
className="text-xs px-3 py-1.5 bg-blue-600 text-white rounded-lg font-medium hover:bg-blue-700"
|
||||
className="text-xs px-3 py-1.5 bg-blue-600 text-white font-medium hover:bg-blue-700"
|
||||
>
|
||||
Triage
|
||||
</Link>
|
||||
@@ -61,7 +61,7 @@ export function IncidentHeader({
|
||||
{canInvestigate && (
|
||||
<Link
|
||||
href={`/hse/incidents/${incidentId}/investigation`}
|
||||
className="text-xs px-3 py-1.5 bg-indigo-600 text-white rounded-lg font-medium hover:bg-indigo-700"
|
||||
className="text-xs px-3 py-1.5 bg-indigo-600 text-white font-medium hover:bg-indigo-700"
|
||||
>
|
||||
Investigate
|
||||
</Link>
|
||||
@@ -69,7 +69,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 rounded-lg font-medium hover:bg-amber-700"
|
||||
className="text-xs px-3 py-1.5 bg-amber-600 text-white font-medium hover:bg-amber-700"
|
||||
>
|
||||
Add CAPA
|
||||
</Link>
|
||||
|
||||
@@ -66,12 +66,12 @@ export function IncidentList({ incidents, basePath }: Props) {
|
||||
<input
|
||||
type="search"
|
||||
placeholder="Search ref, type, site…"
|
||||
className="border border-gray-300 rounded-lg 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-blue-500"
|
||||
value={search}
|
||||
onChange={e => setSearch(e.target.value)}
|
||||
/>
|
||||
<select
|
||||
className="border border-gray-300 rounded-lg 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-blue-500"
|
||||
value={typeFilter}
|
||||
onChange={e => setTypeFilter(e.target.value)}
|
||||
>
|
||||
@@ -81,7 +81,7 @@ export function IncidentList({ incidents, basePath }: Props) {
|
||||
))}
|
||||
</select>
|
||||
<select
|
||||
className="border border-gray-300 rounded-lg 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-blue-500"
|
||||
value={statusFilter}
|
||||
onChange={e => setStatusFilter(e.target.value)}
|
||||
>
|
||||
@@ -95,7 +95,7 @@ export function IncidentList({ incidents, basePath }: Props) {
|
||||
{filtered.length === 0 ? (
|
||||
<div className="text-center py-12 text-gray-500 text-sm">No incidents found</div>
|
||||
) : (
|
||||
<div className="divide-y divide-gray-100 bg-white rounded-xl shadow-sm overflow-hidden">
|
||||
<div className="divide-y divide-divider bg-surface shadow-sm overflow-hidden">
|
||||
{filtered.map(inc => (
|
||||
<Link
|
||||
key={inc.id}
|
||||
|
||||
@@ -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 rounded-lg px-3 py-1.5 text-xs font-semibold disabled:opacity-50 hover:bg-purple-100"
|
||||
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"
|
||||
>
|
||||
{aiDraftLoading ? 'Drafting…' : 'Get AI Draft'}
|
||||
</button>
|
||||
@@ -148,11 +148,11 @@ export function InvestigationForm({ incidentId, existingInvestigationId }: Props
|
||||
<button
|
||||
key={m} type="button"
|
||||
onClick={() => setMethod(m)}
|
||||
className={`px-3 py-1.5 rounded-lg text-sm font-medium border ${
|
||||
method === m
|
||||
? 'bg-blue-600 text-white border-blue-600'
|
||||
: 'bg-white text-gray-700 border-gray-300 hover:border-blue-400'
|
||||
}`}
|
||||
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'
|
||||
}`}
|
||||
>
|
||||
{m === 'five_why' ? '5-Why' : m === 'fishbone' ? 'Fishbone' : 'Other'}
|
||||
</button>
|
||||
@@ -164,19 +164,19 @@ export function InvestigationForm({ incidentId, existingInvestigationId }: Props
|
||||
<div className="space-y-3">
|
||||
<p className="text-sm font-medium text-gray-700">5-Why Analysis</p>
|
||||
{fiveWhy.map((step, i) => (
|
||||
<div key={i} className="border border-gray-200 rounded-lg p-3 space-y-2">
|
||||
<div key={i} className="border border-divider p-3 space-y-2">
|
||||
<label className="block text-xs text-gray-500">Why #{i + 1}</label>
|
||||
<input
|
||||
type="text" value={step.why}
|
||||
onChange={e => updateWhyStep(i, 'why', e.target.value)}
|
||||
placeholder="Why did this happen?"
|
||||
className="w-full rounded border border-gray-300 px-2 py-1.5 text-sm"
|
||||
className="w-full border border-divider px-2 py-1.5 text-sm"
|
||||
/>
|
||||
<textarea
|
||||
value={step.answer}
|
||||
onChange={e => updateWhyStep(i, 'answer', e.target.value)}
|
||||
rows={2} placeholder="Answer / finding…"
|
||||
className="w-full rounded border border-gray-300 px-2 py-1.5 text-sm"
|
||||
className="w-full border border-divider px-2 py-1.5 text-sm"
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
@@ -193,7 +193,7 @@ export function InvestigationForm({ incidentId, existingInvestigationId }: Props
|
||||
<div className="space-y-3">
|
||||
<p className="text-sm font-medium text-gray-700">Fishbone (Ishikawa) Analysis</p>
|
||||
{fishbone.map((cat, catIdx) => (
|
||||
<div key={cat.category} className="border border-gray-200 rounded-lg p-3">
|
||||
<div key={cat.category} className="border border-divider p-3">
|
||||
<p className="text-xs font-semibold text-gray-600 mb-2">{CATEGORY_LABELS[cat.category]}</p>
|
||||
{cat.causes.map((cause, causeIdx) => (
|
||||
<input
|
||||
@@ -201,7 +201,7 @@ export function InvestigationForm({ incidentId, existingInvestigationId }: Props
|
||||
type="text" value={cause}
|
||||
onChange={e => updateFishboneCause(catIdx, causeIdx, e.target.value)}
|
||||
placeholder="Contributing cause…"
|
||||
className="w-full rounded border border-gray-300 px-2 py-1.5 text-sm mb-1.5"
|
||||
className="w-full border border-divider px-2 py-1.5 text-sm mb-1.5"
|
||||
/>
|
||||
))}
|
||||
<button type="button" onClick={() => addFishboneCause(catIdx)}
|
||||
@@ -219,7 +219,7 @@ export function InvestigationForm({ incidentId, existingInvestigationId }: Props
|
||||
<select
|
||||
value={alcoholTest}
|
||||
onChange={e => setAlcoholTest(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"
|
||||
>
|
||||
<option value="">Not conducted</option>
|
||||
<option value="negative">Negative</option>
|
||||
@@ -233,7 +233,7 @@ export function InvestigationForm({ incidentId, existingInvestigationId }: Props
|
||||
<select
|
||||
value={urineTest}
|
||||
onChange={e => setUrineTest(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"
|
||||
>
|
||||
<option value="">Not conducted</option>
|
||||
<option value="negative">Negative</option>
|
||||
@@ -256,7 +256,7 @@ export function InvestigationForm({ incidentId, existingInvestigationId }: Props
|
||||
value={ref}
|
||||
onChange={e => setWitnessRefs(witnessRefs.map((w, j) => (j === i ? e.target.value : w)))}
|
||||
placeholder="e.g. Ali bin Ahmad — statement dated 12/07/2026"
|
||||
className="w-full rounded border border-gray-300 px-2 py-1.5 text-sm mb-1.5"
|
||||
className="w-full border border-divider px-2 py-1.5 text-sm mb-1.5"
|
||||
/>
|
||||
))}
|
||||
<button
|
||||
@@ -274,7 +274,7 @@ export function InvestigationForm({ incidentId, existingInvestigationId }: Props
|
||||
value={findingsText}
|
||||
onChange={e => setFindingsText(e.target.value)}
|
||||
rows={3}
|
||||
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 the sequence of events and contributing factors…"
|
||||
/>
|
||||
</div>
|
||||
@@ -285,7 +285,7 @@ export function InvestigationForm({ incidentId, existingInvestigationId }: Props
|
||||
value={rootCause}
|
||||
onChange={e => setRootCause(e.target.value)}
|
||||
rows={2}
|
||||
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="One-sentence root cause statement…"
|
||||
/>
|
||||
</div>
|
||||
@@ -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="rounded border-gray-300 text-blue-600" />
|
||||
className="border-divider text-blue-600" />
|
||||
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 rounded-lg py-2 text-sm font-semibold disabled:opacity-50">
|
||||
className="w-full bg-indigo-600 text-white py-2 text-sm font-semibold disabled:opacity-50">
|
||||
{saving ? 'Saving…' : existingInvestigationId ? 'Update Investigation' : 'Start Investigation'}
|
||||
</button>
|
||||
</form>
|
||||
|
||||
@@ -35,16 +35,16 @@ export function InvestigationPanel({ investigation: inv }: Props) {
|
||||
const investigatorName = inv.investigator?.name ?? inv.investigator?.email ?? 'Unknown'
|
||||
|
||||
return (
|
||||
<div className="mt-6 bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden">
|
||||
<div className="flex items-center justify-between px-5 py-4 border-b border-gray-100">
|
||||
<div className="mt-6 bg-surface shadow-sm border border-divider overflow-hidden">
|
||||
<div className="flex items-center justify-between px-5 py-4 border-b border-divider">
|
||||
<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'
|
||||
}`}>
|
||||
inv.completed_at
|
||||
? 'bg-green-100 text-green-700'
|
||||
: 'bg-yellow-100 text-yellow-700'
|
||||
}`}>
|
||||
{inv.completed_at ? 'Completed' : 'In Progress'}
|
||||
</span>
|
||||
</div>
|
||||
@@ -107,7 +107,7 @@ export function InvestigationPanel({ investigation: inv }: Props) {
|
||||
|
||||
{/* Root cause */}
|
||||
{inv.root_cause_summary && (
|
||||
<div className="bg-red-50 border border-red-100 rounded-lg px-4 py-3">
|
||||
<div className="bg-red-50 border border-red-100 px-4 py-3">
|
||||
<h3 className="text-xs font-semibold text-red-600 uppercase tracking-wide mb-1">Root Cause</h3>
|
||||
<p className="text-sm text-gray-900 whitespace-pre-wrap">{inv.root_cause_summary}</p>
|
||||
</div>
|
||||
|
||||
@@ -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 rounded-lg p-3 flex items-center justify-between shadow-md z-50">
|
||||
<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">
|
||||
{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 rounded font-medium
|
||||
hover:bg-yellow-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors"
|
||||
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"
|
||||
>
|
||||
{syncing ? 'Syncing…' : 'Sync now'}
|
||||
</button>
|
||||
|
||||
@@ -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-gray-300 rounded-lg 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-blue-500"
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
@@ -205,22 +205,22 @@ export function ReportForm({ zoneToken, trucks, initialTruckId }: Props) {
|
||||
|
||||
if (savedOffline) {
|
||||
return (
|
||||
<div className="bg-green-50 border border-green-200 rounded-xl p-5 text-sm text-green-700">
|
||||
<div className="bg-green-50 border border-green-200 p-5 text-sm text-green-700">
|
||||
{t.savedOffline}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<form onSubmit={handleSubmit} className="space-y-5 bg-white rounded-xl shadow-sm p-5">
|
||||
<form onSubmit={handleSubmit} className="space-y-5 bg-surface shadow-sm p-5">
|
||||
{!isOnline && (
|
||||
<div className="bg-yellow-50 border border-yellow-200 rounded p-3 text-sm text-yellow-700">
|
||||
<div className="bg-yellow-50 border border-yellow-200 p-3 text-sm text-yellow-700">
|
||||
{t.offlineBanner}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{error && (
|
||||
<div className="bg-red-50 border border-red-200 rounded p-3 text-sm text-red-700">
|
||||
<div className="bg-red-50 border border-red-200 p-3 text-sm text-red-700">
|
||||
{error}
|
||||
</div>
|
||||
)}
|
||||
@@ -231,7 +231,7 @@ export function ReportForm({ zoneToken, trucks, initialTruckId }: Props) {
|
||||
</label>
|
||||
<select
|
||||
required
|
||||
className="w-full border border-gray-300 rounded-lg 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-blue-500"
|
||||
value={form.incident_type}
|
||||
onChange={e => {
|
||||
setForm(f => ({ ...f, incident_type: e.target.value as IncidentType, truck_id: '' }))
|
||||
@@ -246,26 +246,26 @@ export function ReportForm({ zoneToken, trucks, initialTruckId }: Props) {
|
||||
</div>
|
||||
|
||||
{form.incident_type === 'environmental' && (
|
||||
<div className="space-y-3 border border-gray-200 rounded-lg p-3">
|
||||
<div className="space-y-3 border border-divider p-3">
|
||||
{detailText('substance', tdLabels.substance, tdLabels.substancePlaceholder)}
|
||||
{detailText('estimated_volume', tdLabels.estimatedVolume, tdLabels.estimatedVolumePlaceholder)}
|
||||
{detailCheckbox('containment_deployed', tdLabels.containmentDeployed)}
|
||||
</div>
|
||||
)}
|
||||
{form.incident_type === 'asset_damage' && (
|
||||
<div className="space-y-3 border border-gray-200 rounded-lg p-3">
|
||||
<div className="space-y-3 border border-divider p-3">
|
||||
{detailText('equipment_id', tdLabels.equipmentId, tdLabels.equipmentIdPlaceholder)}
|
||||
{detailCheckbox('loto_applied', tdLabels.lotoApplied)}
|
||||
</div>
|
||||
)}
|
||||
{form.incident_type === 'security' && (
|
||||
<div className="space-y-3 border border-gray-200 rounded-lg p-3">
|
||||
<div className="space-y-3 border border-divider p-3">
|
||||
{detailText('persons_involved', tdLabels.personsInvolved, tdLabels.personsInvolvedPlaceholder)}
|
||||
{detailCheckbox('police_reported', tdLabels.policeReported)}
|
||||
</div>
|
||||
)}
|
||||
{form.incident_type === 'fire' && (
|
||||
<div className="space-y-3 border border-gray-200 rounded-lg p-3">
|
||||
<div className="space-y-3 border border-divider p-3">
|
||||
{detailCheckbox('alarm_raised', tdLabels.alarmRaised)}
|
||||
{detailCheckbox('fire_brigade_called', tdLabels.fireBrigadeCalled)}
|
||||
</div>
|
||||
@@ -278,7 +278,7 @@ export function ReportForm({ zoneToken, trucks, initialTruckId }: Props) {
|
||||
</label>
|
||||
<select
|
||||
required
|
||||
className="w-full border border-gray-300 rounded-lg 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-blue-500"
|
||||
value={form.truck_id}
|
||||
onChange={e => setForm(f => ({ ...f, truck_id: e.target.value }))}
|
||||
>
|
||||
@@ -301,14 +301,14 @@ export function ReportForm({ zoneToken, trucks, initialTruckId }: Props) {
|
||||
minLength={10}
|
||||
rows={4}
|
||||
placeholder={t.descriptionPlaceholder}
|
||||
className="w-full border border-gray-300 rounded-lg 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-blue-500 resize-none"
|
||||
value={form.description}
|
||||
onChange={e => setForm(f => ({ ...f, description: e.target.value }))}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{qualityCheck && !qualityCheck.passes && (
|
||||
<div className="rounded-lg bg-amber-50 border border-amber-200 p-3 space-y-2">
|
||||
<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">
|
||||
{t.qualityScoreLabel.replace('{score}', String(qualityCheck.score))}
|
||||
</p>
|
||||
@@ -325,7 +325,7 @@ export function ReportForm({ zoneToken, trucks, initialTruckId }: Props) {
|
||||
type="checkbox"
|
||||
checked={overrideQuality}
|
||||
onChange={e => setOverrideQuality(e.target.checked)}
|
||||
className="rounded border-amber-300 text-amber-600"
|
||||
className="border-amber-300 text-amber-600"
|
||||
/>
|
||||
{t.submitAnyway}
|
||||
</label>
|
||||
@@ -350,7 +350,7 @@ export function ReportForm({ zoneToken, trucks, initialTruckId }: Props) {
|
||||
</label>
|
||||
<select
|
||||
required={form.injury_involved}
|
||||
className="w-full border border-gray-300 rounded-lg 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-blue-500"
|
||||
value={form.medical_status}
|
||||
onChange={e => setForm(f => ({ ...f, medical_status: e.target.value as MedicalStatus }))}
|
||||
>
|
||||
@@ -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 rounded-lg font-medium text-sm
|
||||
hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors"
|
||||
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"
|
||||
>
|
||||
{submitting ? t.submitting : t.submitButton}
|
||||
</button>
|
||||
|
||||
@@ -43,7 +43,7 @@ export function SimilarIncidentsPanel({ incidentId }: Props) {
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
<div className="mt-6 bg-white rounded-xl shadow-sm p-5">
|
||||
<div className="mt-6 bg-surface shadow-sm p-5">
|
||||
<p className="text-sm text-gray-400">Loading similar incidents…</p>
|
||||
</div>
|
||||
)
|
||||
@@ -51,7 +51,7 @@ export function SimilarIncidentsPanel({ incidentId }: Props) {
|
||||
if (error || similar.length === 0) return null
|
||||
|
||||
return (
|
||||
<div className="mt-6 bg-white rounded-xl shadow-sm p-5">
|
||||
<div className="mt-6 bg-surface shadow-sm p-5">
|
||||
<h2 className="text-sm font-semibold text-gray-700 uppercase tracking-wide mb-3">
|
||||
Similar Past Incidents
|
||||
</h2>
|
||||
@@ -60,7 +60,7 @@ export function SimilarIncidentsPanel({ incidentId }: Props) {
|
||||
<a
|
||||
key={inc.id}
|
||||
href={`/hse/incidents/${inc.id}`}
|
||||
className="block border border-gray-200 rounded-lg p-3 hover:border-blue-300 hover:bg-blue-50 transition-colors"
|
||||
className="block border border-divider p-3 hover:border-blue-300 hover:bg-blue-50 transition-colors"
|
||||
>
|
||||
<div className="flex items-center justify-between mb-1">
|
||||
<span className="text-xs font-medium text-gray-500">
|
||||
|
||||
@@ -95,17 +95,17 @@ export function TriageForm({ incidentId, currentSeverity }: Props) {
|
||||
<form onSubmit={handleSubmit} className="space-y-6">
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-2">Severity</label>
|
||||
<div className="flex rounded-lg border border-gray-300 overflow-hidden divide-x divide-gray-300">
|
||||
<div className="flex border border-divider overflow-hidden divide-x divide-divider">
|
||||
{([1, 2, 3, 4, 5] as const).map(v => (
|
||||
<button
|
||||
key={v}
|
||||
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-white text-gray-700 hover:bg-gray-50'
|
||||
}`}
|
||||
severity === v
|
||||
? 'bg-blue-600 text-white border-blue-600'
|
||||
: '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="rounded border-gray-300 text-blue-600"
|
||||
className="border-divider text-blue-600"
|
||||
/>
|
||||
{label}
|
||||
</label>
|
||||
@@ -134,7 +134,7 @@ export function TriageForm({ incidentId, currentSeverity }: Props) {
|
||||
</fieldset>
|
||||
|
||||
{dosh.reasons.length > 0 && (
|
||||
<div className="rounded-lg bg-red-50 border border-red-200 p-3 space-y-1">
|
||||
<div className="bg-red-50 border border-red-200 p-3 space-y-1">
|
||||
<p className="text-xs font-semibold text-red-700 uppercase tracking-wide">DOSH Reporting Required</p>
|
||||
{dosh.reasons.map(r => (
|
||||
<p key={r} className="text-xs text-red-600">{r}</p>
|
||||
@@ -151,13 +151,13 @@ export function TriageForm({ incidentId, currentSeverity }: Props) {
|
||||
value={triageNotes}
|
||||
onChange={e => setTriageNotes(e.target.value)}
|
||||
rows={3}
|
||||
className="w-full rounded-lg border border-gray-300 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-blue-500 focus:border-transparent"
|
||||
placeholder="Initial assessment, immediate actions taken..."
|
||||
/>
|
||||
</div>
|
||||
|
||||
{aiRationale && (
|
||||
<div className="rounded-lg bg-purple-50 border border-purple-200 p-3">
|
||||
<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>
|
||||
@@ -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 rounded-lg py-2 text-sm font-semibold disabled:opacity-50 hover:bg-purple-100"
|
||||
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"
|
||||
>
|
||||
{aiLoading ? 'Getting suggestion…' : 'Get AI Suggestion'}
|
||||
</button>
|
||||
<button
|
||||
type="submit"
|
||||
disabled={saving}
|
||||
className="flex-1 bg-blue-600 text-white rounded-lg py-2 text-sm font-semibold disabled:opacity-50"
|
||||
className="flex-1 bg-blue-600 text-white py-2 text-sm font-semibold disabled:opacity-50"
|
||||
>
|
||||
{saving ? 'Saving…' : 'Complete Triage'}
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user