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:
@@ -54,7 +54,7 @@ export default function ChangePasswordForm() {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="bg-white rounded-xl shadow-sm p-5">
|
||||
<div className="bg-surface shadow-sm p-5">
|
||||
<h2 className="text-base font-semibold text-gray-900 mb-4">Change Password</h2>
|
||||
<form onSubmit={handleSubmit} className="space-y-4">
|
||||
<div>
|
||||
@@ -67,7 +67,7 @@ export default function ChangePasswordForm() {
|
||||
onChange={e => setCurrent(e.target.value)}
|
||||
disabled={loading}
|
||||
autoComplete="current-password"
|
||||
className="w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:ring-2 focus:ring-blue-500 focus:border-transparent disabled:opacity-50"
|
||||
className="w-full border border-divider px-3 py-2 text-sm focus:ring-2 focus:ring-blue-500 focus:border-transparent disabled:opacity-50"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
@@ -80,7 +80,7 @@ export default function ChangePasswordForm() {
|
||||
onChange={e => setNewPass(e.target.value)}
|
||||
disabled={loading}
|
||||
autoComplete="new-password"
|
||||
className="w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:ring-2 focus:ring-blue-500 focus:border-transparent disabled:opacity-50"
|
||||
className="w-full border border-divider px-3 py-2 text-sm focus:ring-2 focus:ring-blue-500 focus:border-transparent disabled:opacity-50"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
@@ -93,7 +93,7 @@ export default function ChangePasswordForm() {
|
||||
onChange={e => setConfirm(e.target.value)}
|
||||
disabled={loading}
|
||||
autoComplete="new-password"
|
||||
className="w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:ring-2 focus:ring-blue-500 focus:border-transparent disabled:opacity-50"
|
||||
className="w-full border border-divider px-3 py-2 text-sm focus:ring-2 focus:ring-blue-500 focus:border-transparent disabled:opacity-50"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -103,7 +103,7 @@ export default function ChangePasswordForm() {
|
||||
<button
|
||||
type="submit"
|
||||
disabled={loading}
|
||||
className="bg-blue-600 text-white rounded-lg px-4 py-2 text-sm font-semibold disabled:opacity-50 hover:bg-blue-700"
|
||||
className="bg-blue-600 text-white px-4 py-2 text-sm font-semibold disabled:opacity-50 hover:bg-blue-700"
|
||||
>
|
||||
{loading ? 'Saving…' : 'Update Password'}
|
||||
</button>
|
||||
|
||||
@@ -25,21 +25,21 @@ export function AdminPanel({ users, sites, siteOptions, trucks }: Props) {
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="flex gap-1 border-b border-gray-200 mb-6">
|
||||
<div className="flex gap-1 border-b border-divider mb-6">
|
||||
{tabs.map(t => (
|
||||
<button
|
||||
key={t.id}
|
||||
onClick={() => setTab(t.id)}
|
||||
className={`px-4 py-2.5 text-sm font-medium border-b-2 -mb-px transition-colors cursor-pointer ${
|
||||
tab === t.id
|
||||
? 'border-green-600 text-green-700'
|
||||
: 'border-transparent text-gray-500 hover:text-gray-700'
|
||||
}`}
|
||||
tab === t.id
|
||||
? 'border-green-600 text-green-700'
|
||||
: 'border-transparent text-gray-500 hover:text-gray-700'
|
||||
}`}
|
||||
>
|
||||
{t.label}
|
||||
<span className={`ml-1.5 text-xs px-1.5 py-0.5 rounded-full ${
|
||||
tab === t.id ? 'bg-green-100 text-green-700' : 'bg-gray-100 text-gray-500'
|
||||
}`}>{t.count}</span>
|
||||
tab === t.id ? 'bg-green-100 text-green-700' : 'bg-gray-100 text-gray-500'
|
||||
}`}>{t.count}</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -83,7 +83,7 @@ export function BulkImportForm() {
|
||||
if (stage === 'upload') {
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<label className="block cursor-pointer rounded border-2 border-dashed border-gray-300 p-6 text-center hover:bg-gray-50">
|
||||
<label className="block cursor-pointer border-2 border-dashed border-divider p-6 text-center hover:bg-gray-50">
|
||||
<input
|
||||
type="file"
|
||||
onChange={handleUpload}
|
||||
@@ -201,14 +201,14 @@ export function BulkImportForm() {
|
||||
<div className="flex gap-2">
|
||||
<button
|
||||
onClick={() => setStage('upload')}
|
||||
className="px-4 py-2 text-gray-600 hover:bg-gray-100 rounded"
|
||||
className="px-4 py-2 text-gray-600 hover:bg-gray-100"
|
||||
>
|
||||
Back
|
||||
</button>
|
||||
<button
|
||||
onClick={handleImport}
|
||||
disabled={!canImport || loading}
|
||||
className="px-4 py-2 bg-blue-600 text-white rounded disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
className="px-4 py-2 bg-blue-600 text-white disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
>
|
||||
{loading ? 'Importing...' : 'Import All'}
|
||||
</button>
|
||||
|
||||
@@ -16,7 +16,7 @@ interface Props {
|
||||
sites: SiteWithZones[]
|
||||
}
|
||||
|
||||
const inp = 'w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-green-500 focus:border-green-500'
|
||||
const inp = 'w-full border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-green-500 focus:border-green-500'
|
||||
const lbl = 'block text-xs font-medium text-gray-600 mb-1'
|
||||
|
||||
type DeleteTarget = { kind: 'site'; id: string; name: string } | { kind: 'zone'; id: string; name: string }
|
||||
@@ -81,22 +81,22 @@ export function SiteZoneManager({ sites }: Props) {
|
||||
const totalZones = sites.reduce((n, s) => n + s.zones.length, 0)
|
||||
|
||||
return (
|
||||
<div className="bg-white rounded-xl border border-gray-200 shadow-sm overflow-hidden">
|
||||
<div className="flex items-center justify-between px-5 py-4 border-b border-gray-100">
|
||||
<div className="bg-surface border border-divider shadow-sm overflow-hidden">
|
||||
<div className="flex items-center justify-between px-5 py-4 border-b border-divider">
|
||||
<div>
|
||||
<h2 className="text-sm font-semibold text-gray-900">Sites & Zones</h2>
|
||||
<p className="text-xs text-gray-400 mt-0.5">{sites.length} site{sites.length !== 1 ? 's' : ''} · {totalZones} zone{totalZones !== 1 ? 's' : ''}</p>
|
||||
</div>
|
||||
<div className="flex gap-2">
|
||||
<button onClick={() => { setShowAddZone(true); setError(null) }}
|
||||
className="flex items-center gap-1.5 px-3 py-1.5 bg-gray-100 text-gray-700 text-xs font-semibold rounded-lg hover:bg-gray-200 transition-colors cursor-pointer">
|
||||
className="flex items-center gap-1.5 px-3 py-1.5 bg-gray-100 text-gray-700 text-xs font-semibold hover:bg-gray-200 transition-colors cursor-pointer">
|
||||
<svg className="w-3.5 h-3.5" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2.5}>
|
||||
<path strokeLinecap="round" strokeLinejoin="round" d="M12 4v16m8-8H4" />
|
||||
</svg>
|
||||
Add Zone
|
||||
</button>
|
||||
<button onClick={() => { setShowAddSite(true); setError(null) }}
|
||||
className="flex items-center gap-1.5 px-3 py-1.5 bg-green-600 text-white text-xs font-semibold rounded-lg hover:bg-green-700 transition-colors cursor-pointer">
|
||||
className="flex items-center gap-1.5 px-3 py-1.5 bg-green-600 text-white text-xs font-semibold hover:bg-green-700 transition-colors cursor-pointer">
|
||||
<svg className="w-3.5 h-3.5" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2.5}>
|
||||
<path strokeLinecap="round" strokeLinejoin="round" d="M12 4v16m8-8H4" />
|
||||
</svg>
|
||||
@@ -119,10 +119,10 @@ export function SiteZoneManager({ sites }: Props) {
|
||||
<button disabled={busyId === site.id}
|
||||
onClick={() => send('PATCH', { kind: 'site', id: site.id, active: !site.active })}
|
||||
className={`text-xs font-medium px-2.5 py-1 rounded-full border transition-colors cursor-pointer disabled:opacity-50 ${
|
||||
site.active
|
||||
? 'bg-green-50 text-green-700 border-green-200 hover:bg-green-100'
|
||||
: 'bg-gray-50 text-gray-500 border-gray-200 hover:bg-gray-100'
|
||||
}`}>
|
||||
site.active
|
||||
? 'bg-green-50 text-green-700 border-green-200 hover:bg-green-100'
|
||||
: 'bg-gray-50 text-gray-500 border-divider hover:bg-gray-100'
|
||||
}`}>
|
||||
{site.active ? 'Active' : 'Inactive'}
|
||||
</button>
|
||||
<button disabled={busyId === site.id}
|
||||
@@ -134,7 +134,7 @@ export function SiteZoneManager({ sites }: Props) {
|
||||
</div>
|
||||
|
||||
{site.zones.length > 0 && (
|
||||
<ul className="mt-3 space-y-1.5 pl-3 border-l-2 border-gray-100">
|
||||
<ul className="mt-3 space-y-1.5 pl-3 border-l-2 border-divider">
|
||||
{site.zones.map(z => (
|
||||
<li key={z.id} className={`flex items-center justify-between ${!z.active ? 'opacity-50' : ''}`}>
|
||||
<span className="text-xs text-gray-700 font-medium">{z.name}</span>
|
||||
@@ -146,10 +146,10 @@ export function SiteZoneManager({ sites }: Props) {
|
||||
<button disabled={busyId === z.id}
|
||||
onClick={() => send('PATCH', { kind: 'zone', id: z.id, active: !z.active })}
|
||||
className={`text-xs font-medium px-2 py-0.5 rounded-full border transition-colors cursor-pointer disabled:opacity-50 ${
|
||||
z.active
|
||||
? 'bg-green-50 text-green-700 border-green-200 hover:bg-green-100'
|
||||
: 'bg-gray-50 text-gray-500 border-gray-200 hover:bg-gray-100'
|
||||
}`}>
|
||||
z.active
|
||||
? 'bg-green-50 text-green-700 border-green-200 hover:bg-green-100'
|
||||
: 'bg-gray-50 text-gray-500 border-divider hover:bg-gray-100'
|
||||
}`}>
|
||||
{z.active ? 'Active' : 'Inactive'}
|
||||
</button>
|
||||
<button disabled={busyId === z.id}
|
||||
@@ -178,18 +178,18 @@ export function SiteZoneManager({ sites }: Props) {
|
||||
footer={
|
||||
<>
|
||||
<button onClick={() => { setShowAddSite(false); setSiteName(''); setError(null) }}
|
||||
className="px-4 py-2 text-sm font-medium rounded-lg border border-gray-300 text-gray-700 hover:bg-gray-50 cursor-pointer transition-colors">
|
||||
className="px-4 py-2 text-sm font-medium border border-divider text-gray-700 hover:bg-gray-50 cursor-pointer transition-colors">
|
||||
Cancel
|
||||
</button>
|
||||
<button disabled={busy || !siteName.trim()}
|
||||
onClick={async () => { if (await post({ kind: 'site', name: siteName })) { setSiteName(''); setShowAddSite(false) } }}
|
||||
className="px-4 py-2 bg-green-600 text-white text-sm font-semibold rounded-lg hover:bg-green-700 disabled:opacity-50 cursor-pointer transition-colors">
|
||||
className="px-4 py-2 bg-green-600 text-white text-sm font-semibold hover:bg-green-700 disabled:opacity-50 cursor-pointer transition-colors">
|
||||
{busy ? 'Adding…' : 'Add Site'}
|
||||
</button>
|
||||
</>
|
||||
}
|
||||
>
|
||||
{error && <p className="text-xs text-red-600 bg-red-50 px-3 py-2 rounded-lg mb-3">{error}</p>}
|
||||
{error && <p className="text-xs text-red-600 bg-red-50 px-3 py-2 mb-3">{error}</p>}
|
||||
<div>
|
||||
<label className={lbl} htmlFor="add-site-name">Site Name *</label>
|
||||
<input id="add-site-name" type="text" placeholder="e.g. Setia Warehouse KL"
|
||||
@@ -205,7 +205,7 @@ export function SiteZoneManager({ sites }: Props) {
|
||||
footer={
|
||||
<>
|
||||
<button onClick={() => { setShowAddZone(false); setZoneName(''); setZoneSiteId(''); setError(null) }}
|
||||
className="px-4 py-2 text-sm font-medium rounded-lg border border-gray-300 text-gray-700 hover:bg-gray-50 cursor-pointer transition-colors">
|
||||
className="px-4 py-2 text-sm font-medium border border-divider text-gray-700 hover:bg-gray-50 cursor-pointer transition-colors">
|
||||
Cancel
|
||||
</button>
|
||||
<button disabled={busy || !zoneName.trim() || !zoneSiteId}
|
||||
@@ -214,13 +214,13 @@ export function SiteZoneManager({ sites }: Props) {
|
||||
setZoneName(''); setZoneSiteId(''); setShowAddZone(false)
|
||||
}
|
||||
}}
|
||||
className="px-4 py-2 bg-green-600 text-white text-sm font-semibold rounded-lg hover:bg-green-700 disabled:opacity-50 cursor-pointer transition-colors">
|
||||
className="px-4 py-2 bg-green-600 text-white text-sm font-semibold hover:bg-green-700 disabled:opacity-50 cursor-pointer transition-colors">
|
||||
{busy ? 'Adding…' : 'Add Zone'}
|
||||
</button>
|
||||
</>
|
||||
}
|
||||
>
|
||||
{error && <p className="text-xs text-red-600 bg-red-50 px-3 py-2 rounded-lg mb-3">{error}</p>}
|
||||
{error && <p className="text-xs text-red-600 bg-red-50 px-3 py-2 mb-3">{error}</p>}
|
||||
<div className="space-y-4">
|
||||
<div>
|
||||
<label className={lbl} htmlFor="add-zone-site">Site *</label>
|
||||
@@ -243,12 +243,12 @@ export function SiteZoneManager({ sites }: Props) {
|
||||
footer={
|
||||
<>
|
||||
<button onClick={() => setConfirmDelete(null)}
|
||||
className="px-4 py-2 text-sm font-medium rounded-lg border border-gray-300 text-gray-700 hover:bg-gray-50 cursor-pointer transition-colors">
|
||||
className="px-4 py-2 text-sm font-medium border border-divider text-gray-700 hover:bg-gray-50 cursor-pointer transition-colors">
|
||||
Cancel
|
||||
</button>
|
||||
<button disabled={!!(confirmDelete && busyId === confirmDelete.id)}
|
||||
onClick={() => confirmDelete && handleDelete(confirmDelete)}
|
||||
className="px-4 py-2 bg-red-600 text-white text-sm font-semibold rounded-lg hover:bg-red-700 disabled:opacity-50 cursor-pointer transition-colors">
|
||||
className="px-4 py-2 bg-red-600 text-white text-sm font-semibold hover:bg-red-700 disabled:opacity-50 cursor-pointer transition-colors">
|
||||
Delete
|
||||
</button>
|
||||
</>
|
||||
|
||||
@@ -15,7 +15,7 @@ interface Props {
|
||||
trucks: Truck[]
|
||||
}
|
||||
|
||||
const inp = 'w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-green-500 focus:border-green-500'
|
||||
const inp = 'w-full border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-green-500 focus:border-green-500'
|
||||
const lbl = 'block text-xs font-medium text-gray-600 mb-1'
|
||||
|
||||
export function TruckManager({ trucks }: Props) {
|
||||
@@ -83,14 +83,14 @@ export function TruckManager({ trucks }: Props) {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="bg-white rounded-xl border border-gray-200 shadow-sm overflow-hidden">
|
||||
<div className="flex items-center justify-between px-5 py-4 border-b border-gray-100">
|
||||
<div className="bg-surface border border-divider shadow-sm overflow-hidden">
|
||||
<div className="flex items-center justify-between px-5 py-4 border-b border-divider">
|
||||
<div>
|
||||
<h2 className="text-sm font-semibold text-gray-900">Trucks</h2>
|
||||
<p className="text-xs text-gray-400 mt-0.5">{trucks.length} vehicle{trucks.length !== 1 ? 's' : ''}</p>
|
||||
</div>
|
||||
<button onClick={() => { setShowAdd(true); setError(null) }}
|
||||
className="flex items-center gap-1.5 px-3 py-1.5 bg-green-600 text-white text-xs font-semibold rounded-lg hover:bg-green-700 transition-colors cursor-pointer">
|
||||
className="flex items-center gap-1.5 px-3 py-1.5 bg-green-600 text-white text-xs font-semibold hover:bg-green-700 transition-colors cursor-pointer">
|
||||
<svg className="w-3.5 h-3.5" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2.5}>
|
||||
<path strokeLinecap="round" strokeLinejoin="round" d="M12 4v16m8-8H4" />
|
||||
</svg>
|
||||
@@ -115,10 +115,10 @@ export function TruckManager({ trucks }: Props) {
|
||||
<button disabled={busyId === tk.id}
|
||||
onClick={() => send('PATCH', { id: tk.id, active: !tk.active })}
|
||||
className={`text-xs font-medium px-2.5 py-1 rounded-full border transition-colors cursor-pointer disabled:opacity-50 ${
|
||||
tk.active
|
||||
? 'bg-green-50 text-green-700 border-green-200 hover:bg-green-100'
|
||||
: 'bg-gray-50 text-gray-500 border-gray-200 hover:bg-gray-100'
|
||||
}`}>
|
||||
tk.active
|
||||
? 'bg-green-50 text-green-700 border-green-200 hover:bg-green-100'
|
||||
: 'bg-gray-50 text-gray-500 border-divider hover:bg-gray-100'
|
||||
}`}>
|
||||
{tk.active ? 'Active' : 'Inactive'}
|
||||
</button>
|
||||
<button disabled={busyId === tk.id} onClick={() => setConfirmDelete(tk)}
|
||||
@@ -139,17 +139,17 @@ export function TruckManager({ trucks }: Props) {
|
||||
footer={
|
||||
<>
|
||||
<button onClick={() => { setShowAdd(false); setTruckNo(''); setCarrier(''); setError(null) }}
|
||||
className="px-4 py-2 text-sm font-medium rounded-lg border border-gray-300 text-gray-700 hover:bg-gray-50 cursor-pointer transition-colors">
|
||||
className="px-4 py-2 text-sm font-medium border border-divider text-gray-700 hover:bg-gray-50 cursor-pointer transition-colors">
|
||||
Cancel
|
||||
</button>
|
||||
<button disabled={submitting || !truckNo.trim()} onClick={handleAdd}
|
||||
className="px-4 py-2 bg-green-600 text-white text-sm font-semibold rounded-lg hover:bg-green-700 disabled:opacity-50 cursor-pointer transition-colors">
|
||||
className="px-4 py-2 bg-green-600 text-white text-sm font-semibold hover:bg-green-700 disabled:opacity-50 cursor-pointer transition-colors">
|
||||
{submitting ? 'Adding…' : 'Add Truck'}
|
||||
</button>
|
||||
</>
|
||||
}
|
||||
>
|
||||
{error && <p className="text-xs text-red-600 bg-red-50 px-3 py-2 rounded-lg mb-3">{error}</p>}
|
||||
{error && <p className="text-xs text-red-600 bg-red-50 px-3 py-2 mb-3">{error}</p>}
|
||||
<div className="space-y-4">
|
||||
<div>
|
||||
<label className={lbl} htmlFor="add-truck-no">Truck Number *</label>
|
||||
@@ -173,12 +173,12 @@ export function TruckManager({ trucks }: Props) {
|
||||
footer={
|
||||
<>
|
||||
<button onClick={() => setConfirmDelete(null)}
|
||||
className="px-4 py-2 text-sm font-medium rounded-lg border border-gray-300 text-gray-700 hover:bg-gray-50 cursor-pointer transition-colors">
|
||||
className="px-4 py-2 text-sm font-medium border border-divider text-gray-700 hover:bg-gray-50 cursor-pointer transition-colors">
|
||||
Cancel
|
||||
</button>
|
||||
<button disabled={busyId === confirmDelete?.id}
|
||||
onClick={() => confirmDelete && handleDelete(confirmDelete)}
|
||||
className="px-4 py-2 bg-red-600 text-white text-sm font-semibold rounded-lg hover:bg-red-700 disabled:opacity-50 cursor-pointer transition-colors">
|
||||
className="px-4 py-2 bg-red-600 text-white text-sm font-semibold hover:bg-red-700 disabled:opacity-50 cursor-pointer transition-colors">
|
||||
{busyId === confirmDelete?.id ? 'Deleting…' : 'Delete'}
|
||||
</button>
|
||||
</>
|
||||
|
||||
@@ -24,7 +24,7 @@ interface Props {
|
||||
|
||||
const EMPTY = { email: '', name: '', phone: '', role: 'reporter' as UserRole, site_id: '', password: '' }
|
||||
|
||||
const inp = 'w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-green-500 focus:border-green-500'
|
||||
const inp = 'w-full border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-green-500 focus:border-green-500'
|
||||
const lbl = 'block text-xs font-medium text-gray-600 mb-1'
|
||||
|
||||
export function UserManager({ users, sites }: Props) {
|
||||
@@ -95,15 +95,15 @@ export function UserManager({ users, sites }: Props) {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="bg-white rounded-xl border border-gray-200 shadow-sm overflow-hidden">
|
||||
<div className="flex items-center justify-between px-5 py-4 border-b border-gray-100">
|
||||
<div className="bg-surface border border-divider shadow-sm overflow-hidden">
|
||||
<div className="flex items-center justify-between px-5 py-4 border-b border-divider">
|
||||
<div>
|
||||
<h2 className="text-sm font-semibold text-gray-900">Users</h2>
|
||||
<p className="text-xs text-gray-400 mt-0.5">{users.length} account{users.length !== 1 ? 's' : ''}</p>
|
||||
</div>
|
||||
<button
|
||||
onClick={() => { setShowAdd(true); setError(null) }}
|
||||
className="flex items-center gap-1.5 px-3 py-1.5 bg-green-600 text-white text-xs font-semibold rounded-lg hover:bg-green-700 transition-colors cursor-pointer"
|
||||
className="flex items-center gap-1.5 px-3 py-1.5 bg-green-600 text-white text-xs font-semibold hover:bg-green-700 transition-colors cursor-pointer"
|
||||
>
|
||||
<svg className="w-3.5 h-3.5" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2.5}>
|
||||
<path strokeLinecap="round" strokeLinejoin="round" d="M12 4v16m8-8H4" />
|
||||
@@ -134,14 +134,14 @@ export function UserManager({ users, sites }: Props) {
|
||||
<td className="px-5 py-3">
|
||||
<select value={u.role} disabled={busyId === u.id}
|
||||
onChange={e => patchUser(u.id, { role: e.target.value })}
|
||||
className="border border-gray-200 rounded-lg px-2 py-1 text-xs focus:outline-none focus:ring-1 focus:ring-green-500 cursor-pointer">
|
||||
className="border border-divider px-2 py-1 text-xs focus:outline-none focus:ring-1 focus:ring-green-500 cursor-pointer">
|
||||
{ALL_ROLES.map(r => <option key={r} value={r}>{r.replace(/_/g, ' ')}</option>)}
|
||||
</select>
|
||||
</td>
|
||||
<td className="px-5 py-3">
|
||||
<select value={u.site_id ?? ''} disabled={busyId === u.id}
|
||||
onChange={e => patchUser(u.id, { site_id: e.target.value || null })}
|
||||
className="border border-gray-200 rounded-lg px-2 py-1 text-xs focus:outline-none focus:ring-1 focus:ring-green-500 cursor-pointer">
|
||||
className="border border-divider px-2 py-1 text-xs focus:outline-none focus:ring-1 focus:ring-green-500 cursor-pointer">
|
||||
<option value="">No site</option>
|
||||
{sites.map(s => <option key={s.id} value={s.id}>{s.name}</option>)}
|
||||
</select>
|
||||
@@ -150,10 +150,10 @@ export function UserManager({ users, sites }: Props) {
|
||||
<button disabled={busyId === u.id}
|
||||
onClick={() => patchUser(u.id, { active: !u.active })}
|
||||
className={`text-xs px-2.5 py-1 rounded-full font-medium border transition-colors cursor-pointer ${
|
||||
u.active
|
||||
? 'bg-green-50 text-green-700 border-green-200 hover:bg-green-100'
|
||||
: 'bg-gray-50 text-gray-500 border-gray-200 hover:bg-gray-100'
|
||||
}`}>
|
||||
u.active
|
||||
? 'bg-green-50 text-green-700 border-green-200 hover:bg-green-100'
|
||||
: 'bg-gray-50 text-gray-500 border-divider hover:bg-gray-100'
|
||||
}`}>
|
||||
{u.active ? 'Active' : 'Inactive'}
|
||||
</button>
|
||||
</td>
|
||||
@@ -178,18 +178,18 @@ export function UserManager({ users, sites }: Props) {
|
||||
footer={
|
||||
<>
|
||||
<button type="button" onClick={() => { setShowAdd(false); setForm(EMPTY); setError(null) }}
|
||||
className="px-4 py-2 text-sm font-medium rounded-lg border border-gray-300 text-gray-700 hover:bg-gray-50 cursor-pointer transition-colors">
|
||||
className="px-4 py-2 text-sm font-medium border border-divider text-gray-700 hover:bg-gray-50 cursor-pointer transition-colors">
|
||||
Cancel
|
||||
</button>
|
||||
<button form="add-user-form" type="submit" disabled={submitting}
|
||||
className="px-4 py-2 bg-green-600 text-white text-sm font-semibold rounded-lg hover:bg-green-700 disabled:opacity-50 cursor-pointer transition-colors">
|
||||
className="px-4 py-2 bg-green-600 text-white text-sm font-semibold hover:bg-green-700 disabled:opacity-50 cursor-pointer transition-colors">
|
||||
{submitting ? 'Adding…' : 'Add User'}
|
||||
</button>
|
||||
</>
|
||||
}
|
||||
>
|
||||
<form id="add-user-form" onSubmit={handleSubmit} className="space-y-4">
|
||||
{error && <p className="text-xs text-red-600 bg-red-50 px-3 py-2 rounded-lg">{error}</p>}
|
||||
{error && <p className="text-xs text-red-600 bg-red-50 px-3 py-2">{error}</p>}
|
||||
<div className="grid grid-cols-2 gap-3">
|
||||
<div>
|
||||
<label className={lbl} htmlFor="au-email">Email *</label>
|
||||
@@ -245,12 +245,12 @@ export function UserManager({ users, sites }: Props) {
|
||||
footer={
|
||||
<>
|
||||
<button onClick={() => setConfirmDelete(null)}
|
||||
className="px-4 py-2 text-sm font-medium rounded-lg border border-gray-300 text-gray-700 hover:bg-gray-50 cursor-pointer transition-colors">
|
||||
className="px-4 py-2 text-sm font-medium border border-divider text-gray-700 hover:bg-gray-50 cursor-pointer transition-colors">
|
||||
Cancel
|
||||
</button>
|
||||
<button disabled={busyId === confirmDelete?.id}
|
||||
onClick={() => confirmDelete && deleteUser(confirmDelete)}
|
||||
className="px-4 py-2 bg-red-600 text-white text-sm font-semibold rounded-lg hover:bg-red-700 disabled:opacity-50 cursor-pointer transition-colors">
|
||||
className="px-4 py-2 bg-red-600 text-white text-sm font-semibold hover:bg-red-700 disabled:opacity-50 cursor-pointer transition-colors">
|
||||
{busyId === confirmDelete?.id ? 'Deleting…' : 'Delete'}
|
||||
</button>
|
||||
</>
|
||||
|
||||
@@ -43,7 +43,7 @@ export function LoginForm() {
|
||||
</div>
|
||||
|
||||
{error && (
|
||||
<p className="bg-red-50 border border-red-200 text-red-700 text-sm rounded px-3 py-2">
|
||||
<p className="bg-red-50 border border-red-200 text-red-700 text-sm px-3 py-2">
|
||||
{error}
|
||||
</p>
|
||||
)}
|
||||
@@ -55,7 +55,7 @@ export function LoginForm() {
|
||||
onChange={(e) => setEmail(e.target.value)}
|
||||
required
|
||||
autoComplete="email"
|
||||
className="border rounded-md px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
className="border px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
/>
|
||||
<input
|
||||
type="password"
|
||||
@@ -64,12 +64,12 @@ export function LoginForm() {
|
||||
onChange={(e) => setPassword(e.target.value)}
|
||||
required
|
||||
autoComplete="current-password"
|
||||
className="border rounded-md px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
className="border px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
/>
|
||||
<button
|
||||
type="submit"
|
||||
disabled={loading}
|
||||
className="bg-blue-600 hover:bg-blue-700 text-white font-medium py-2 rounded-md disabled:opacity-50 transition-colors"
|
||||
className="bg-blue-600 hover:bg-blue-700 text-white font-medium py-2 disabled:opacity-50 transition-colors"
|
||||
>
|
||||
{loading ? 'Signing in…' : 'Sign in'}
|
||||
</button>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
)}
|
||||
|
||||
@@ -15,16 +15,16 @@ function TabsInner({ activeTab }: { activeTab: string }) {
|
||||
const pathname = usePathname()
|
||||
|
||||
return (
|
||||
<div className="flex border-b border-gray-200 mb-6 overflow-x-auto -mx-4 px-4">
|
||||
<div className="flex border-b border-divider mb-6 overflow-x-auto -mx-4 px-4">
|
||||
{TABS.map(tab => (
|
||||
<button
|
||||
key={tab.key}
|
||||
onClick={() => router.replace(`${pathname}?tab=${tab.key}`)}
|
||||
className={`px-4 py-2.5 text-sm font-medium whitespace-nowrap border-b-2 transition-colors ${
|
||||
activeTab === tab.key
|
||||
? 'border-blue-600 text-blue-600'
|
||||
: 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'
|
||||
}`}
|
||||
activeTab === tab.key
|
||||
? 'border-blue-600 text-blue-600'
|
||||
: 'border-transparent text-gray-500 hover:text-gray-700 hover:border-divider'
|
||||
}`}
|
||||
>
|
||||
{tab.label}
|
||||
</button>
|
||||
@@ -35,7 +35,7 @@ function TabsInner({ activeTab }: { activeTab: string }) {
|
||||
|
||||
export function DashboardTabs({ activeTab }: { activeTab: string }) {
|
||||
return (
|
||||
<Suspense fallback={<div className="h-11 mb-6 border-b border-gray-200" />}>
|
||||
<Suspense fallback={<div className="h-11 mb-6 border-b border-divider" />}>
|
||||
<TabsInner activeTab={activeTab} />
|
||||
</Suspense>
|
||||
)
|
||||
|
||||
@@ -43,7 +43,7 @@ export function RiskFlagsPanel() {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="bg-white rounded-xl shadow-sm p-5 mb-4">
|
||||
<div className="bg-surface shadow-sm p-5 mb-4">
|
||||
<div className="flex items-center justify-between mb-1">
|
||||
<h2 className="text-sm font-semibold text-gray-700 uppercase tracking-wide">
|
||||
Rising-Risk Zones (AI)
|
||||
@@ -51,7 +51,7 @@ export function RiskFlagsPanel() {
|
||||
<button
|
||||
onClick={analyze}
|
||||
disabled={loading}
|
||||
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"
|
||||
>
|
||||
{loading ? 'Analyzing…' : flags ? 'Re-analyze' : 'Analyze 90-Day Risk'}
|
||||
</button>
|
||||
@@ -71,7 +71,7 @@ export function RiskFlagsPanel() {
|
||||
<p className="text-sm text-gray-700 mb-3">{summary}</p>
|
||||
<div className="space-y-2">
|
||||
{flags.map(f => (
|
||||
<div key={`${f.site}-${f.zone}`} className={`border rounded-lg p-3 ${LEVEL_COLORS[f.risk_level]}`}>
|
||||
<div key={`${f.site}-${f.zone}`} className={`border p-3 ${LEVEL_COLORS[f.risk_level]}`}>
|
||||
<div className="flex items-center justify-between mb-1">
|
||||
<span className="text-sm font-semibold">{f.zone} · {f.site}</span>
|
||||
<span className="text-xs font-bold uppercase">{f.risk_level}</span>
|
||||
|
||||
@@ -14,7 +14,7 @@ const ACCENT = {
|
||||
|
||||
export function StatCard({ label, value, sub, accent = 'default' }: Props) {
|
||||
return (
|
||||
<div className={`bg-white rounded-xl shadow-sm p-5 border-t-4 ${ACCENT[accent]}`}>
|
||||
<div className={`bg-surface shadow-sm p-5 border-t-4 ${ACCENT[accent]}`}>
|
||||
<p className="text-xs text-gray-500 uppercase tracking-wide font-medium">{label}</p>
|
||||
<p className="text-3xl font-bold text-gray-900 mt-1">{value}</p>
|
||||
{sub && <p className="text-xs text-gray-400 mt-1">{sub}</p>}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -33,7 +33,7 @@ export function LanguageSwitcher() {
|
||||
value={current}
|
||||
onChange={e => handleChange(e.target.value)}
|
||||
aria-label="Select language"
|
||||
className="text-xs border border-gray-300 rounded px-2 py-1 bg-white text-gray-700 focus:outline-none focus:ring-1 focus:ring-blue-500"
|
||||
className="text-xs border border-divider px-2 py-1 bg-surface text-gray-700 focus:outline-none focus:ring-1 focus:ring-blue-500"
|
||||
>
|
||||
{Object.entries(LOCALES).map(([code, label]) => (
|
||||
<option key={code} value={code}>{label}</option>
|
||||
|
||||
@@ -117,11 +117,11 @@ function NavLink({ item, pathname }: { item: NavItem; pathname: string }) {
|
||||
return (
|
||||
<Link
|
||||
href={item.href}
|
||||
className={`flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium transition-colors ${
|
||||
isActive
|
||||
? 'bg-blue-50 text-blue-700'
|
||||
: 'text-gray-600 hover:bg-gray-100 hover:text-gray-900'
|
||||
}`}
|
||||
className={`flex items-center gap-3 px-3 py-2 text-sm font-medium transition-colors ${
|
||||
isActive
|
||||
? 'bg-blue-50 text-blue-700'
|
||||
: 'text-gray-600 hover:bg-gray-100 hover:text-gray-900'
|
||||
}`}
|
||||
>
|
||||
<span className={isActive ? 'text-blue-600' : 'text-gray-400'}>{item.icon}</span>
|
||||
{item.label}
|
||||
@@ -147,9 +147,9 @@ export function Sidebar({ role, userName, userEmail }: SidebarProps) {
|
||||
return (
|
||||
<>
|
||||
{/* Desktop sidebar */}
|
||||
<aside className="hidden sm:flex fixed left-0 top-0 h-full w-60 bg-white border-r border-gray-200 flex-col z-40">
|
||||
<aside className="hidden sm:flex fixed left-0 top-0 h-full w-60 bg-surface border-r border-divider flex-col z-40">
|
||||
{/* Header */}
|
||||
<div className="flex items-center justify-between px-4 py-4 border-b border-gray-100">
|
||||
<div className="flex items-center justify-between px-4 py-4 border-b border-divider">
|
||||
<span className="text-base font-bold text-gray-900 tracking-tight">IMS</span>
|
||||
<NotificationBell />
|
||||
</div>
|
||||
@@ -162,7 +162,7 @@ export function Sidebar({ role, userName, userEmail }: SidebarProps) {
|
||||
</nav>
|
||||
|
||||
{/* User + logout */}
|
||||
<div className="border-t border-gray-100 px-3 py-3">
|
||||
<div className="border-t border-divider px-3 py-3">
|
||||
<div className="flex items-center gap-2 px-2 py-2 mb-1">
|
||||
<div className="w-8 h-8 rounded-full bg-blue-600 flex items-center justify-center text-white text-xs font-bold flex-shrink-0">
|
||||
{initials(displayName)}
|
||||
@@ -174,11 +174,11 @@ export function Sidebar({ role, userName, userEmail }: SidebarProps) {
|
||||
</div>
|
||||
<Link
|
||||
href="/account"
|
||||
className={`flex items-center gap-2 w-full px-3 py-2 text-sm rounded-lg transition-colors ${
|
||||
pathname === '/account'
|
||||
? 'bg-blue-50 text-blue-700'
|
||||
: 'text-gray-600 hover:bg-gray-100 hover:text-gray-900'
|
||||
}`}
|
||||
className={`flex items-center gap-2 w-full px-3 py-2 text-sm transition-colors ${
|
||||
pathname === '/account'
|
||||
? 'bg-blue-50 text-blue-700'
|
||||
: 'text-gray-600 hover:bg-gray-100 hover:text-gray-900'
|
||||
}`}
|
||||
>
|
||||
<span className={pathname === '/account' ? 'text-blue-600' : 'text-gray-400'}>
|
||||
<IconUser />
|
||||
@@ -187,19 +187,19 @@ export function Sidebar({ role, userName, userEmail }: SidebarProps) {
|
||||
</Link>
|
||||
<button
|
||||
onClick={logout}
|
||||
className="flex items-center gap-2 w-full px-3 py-2 text-sm text-gray-600 hover:bg-gray-100 hover:text-gray-900 rounded-lg transition-colors"
|
||||
className="flex items-center gap-2 w-full px-3 py-2 text-sm text-gray-600 hover:bg-gray-100 hover:text-gray-900 transition-colors"
|
||||
>
|
||||
<IconLogout />
|
||||
Logout
|
||||
</button>
|
||||
<div className="mt-3 pt-3 border-t border-gray-100 px-2 text-center">
|
||||
<div className="mt-3 pt-3 border-t border-divider px-2 text-center">
|
||||
<p className="text-xs text-gray-400">v1.2.2</p>
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
{/* Mobile bottom tab bar */}
|
||||
<nav className="sm:hidden fixed bottom-0 left-0 right-0 bg-white border-t border-gray-200 flex z-40 safe-area-pb">
|
||||
<nav className="sm:hidden fixed bottom-0 left-0 right-0 bg-surface border-t border-divider flex z-40 safe-area-pb">
|
||||
{mobileItems.map(item => {
|
||||
const exactRoots = ['/reporter', '/supervisor', '/management', '/capa-owner', '/admin', '/report', '/account']
|
||||
const isActive = exactRoots.includes(item.href)
|
||||
@@ -210,8 +210,8 @@ export function Sidebar({ role, userName, userEmail }: SidebarProps) {
|
||||
key={item.href}
|
||||
href={item.href}
|
||||
className={`flex-1 flex flex-col items-center gap-1 py-2 text-[10px] font-medium transition-colors ${
|
||||
isActive ? 'text-blue-600' : 'text-gray-400'
|
||||
}`}
|
||||
isActive ? 'text-blue-600' : 'text-gray-400'
|
||||
}`}
|
||||
>
|
||||
{item.icon}
|
||||
<span className="leading-none">{item.label}</span>
|
||||
|
||||
@@ -62,7 +62,7 @@ export function NotificationBell() {
|
||||
<button
|
||||
onClick={() => setOpen(o => !o)}
|
||||
aria-label={`Notifications${unread > 0 ? ` (${unread} unread)` : ''}`}
|
||||
className="relative bg-white rounded-full shadow-sm border border-gray-200 w-10 h-10 flex items-center justify-center hover:shadow-md transition-shadow"
|
||||
className="relative bg-surface rounded-full shadow-sm border border-divider w-10 h-10 flex items-center justify-center hover:shadow-md transition-shadow"
|
||||
>
|
||||
<span className="text-lg" aria-hidden>🔔</span>
|
||||
{unread > 0 && (
|
||||
@@ -73,8 +73,8 @@ export function NotificationBell() {
|
||||
</button>
|
||||
|
||||
{open && (
|
||||
<div className="absolute right-0 mt-2 w-80 max-h-96 overflow-y-auto bg-white rounded-xl shadow-lg border border-gray-200">
|
||||
<div className="flex items-center justify-between px-4 py-2 border-b border-gray-100">
|
||||
<div className="absolute right-0 mt-2 w-80 max-h-96 overflow-y-auto bg-surface shadow-lg border border-divider">
|
||||
<div className="flex items-center justify-between px-4 py-2 border-b border-divider">
|
||||
<span className="text-sm font-semibold text-gray-700">Notifications</span>
|
||||
{unread > 0 && (
|
||||
<button onClick={markAllRead} className="text-xs text-blue-600 hover:underline">
|
||||
|
||||
@@ -44,14 +44,14 @@ export function ApiKeyForm({ settings }: Props) {
|
||||
{Object.keys(KEY_LABELS).map(key => {
|
||||
const status = settings[key]
|
||||
return (
|
||||
<div key={key} className="bg-white rounded-xl shadow-sm p-5">
|
||||
<div key={key} className="bg-surface shadow-sm p-5">
|
||||
<div className="flex items-center justify-between mb-1">
|
||||
<label className="text-sm font-semibold text-gray-800">{KEY_LABELS[key]}</label>
|
||||
<span className={`text-xs font-medium px-2 py-0.5 rounded-full ${
|
||||
status?.set
|
||||
? 'bg-green-100 text-green-700'
|
||||
: 'bg-yellow-100 text-yellow-700'
|
||||
}`}>
|
||||
status?.set
|
||||
? 'bg-green-100 text-green-700'
|
||||
: 'bg-yellow-100 text-yellow-700'
|
||||
}`}>
|
||||
{status?.set ? 'Configured' : 'Not set'}
|
||||
</span>
|
||||
</div>
|
||||
@@ -66,12 +66,12 @@ export function ApiKeyForm({ settings }: Props) {
|
||||
value={values[key]}
|
||||
onChange={e => setValues(v => ({ ...v, [key]: e.target.value }))}
|
||||
placeholder={status?.set ? 'Enter new key to replace…' : 'Enter API key…'}
|
||||
className="flex-1 border border-gray-300 rounded-lg px-3 py-2 text-sm text-gray-900 placeholder-gray-500 focus:ring-2 focus:ring-blue-500 focus:border-transparent font-mono"
|
||||
className="flex-1 border border-divider px-3 py-2 text-sm text-gray-900 placeholder-gray-500 focus:ring-2 focus:ring-blue-500 focus:border-transparent font-mono"
|
||||
/>
|
||||
<button
|
||||
onClick={() => save(key)}
|
||||
disabled={saving[key] || !values[key]}
|
||||
className="bg-blue-600 text-white rounded-lg px-4 py-2 text-sm font-semibold disabled:opacity-50 hover:bg-blue-700"
|
||||
className="bg-blue-600 text-white px-4 py-2 text-sm font-semibold disabled:opacity-50 hover:bg-blue-700"
|
||||
>
|
||||
{saving[key] ? 'Saving…' : 'Save'}
|
||||
</button>
|
||||
|
||||
@@ -26,11 +26,11 @@ export function Modal({ open, onClose, title, children, footer, width = 'md' }:
|
||||
return (
|
||||
<div className="fixed inset-0 z-50 flex items-center justify-center p-4" role="dialog" aria-modal="true">
|
||||
<div className="absolute inset-0 bg-gray-900/50" onClick={onClose} />
|
||||
<div className={`relative w-full ${maxW} bg-white rounded-2xl shadow-2xl`}>
|
||||
<div className="flex items-center justify-between px-6 py-4 border-b border-gray-100">
|
||||
<div className={`relative w-full ${maxW} bg-surface shadow-lg`}>
|
||||
<div className="flex items-center justify-between px-6 py-4 border-b border-divider">
|
||||
<h2 className="text-sm font-semibold text-gray-900">{title}</h2>
|
||||
<button onClick={onClose} aria-label="Close"
|
||||
className="text-gray-400 hover:text-gray-600 p-1 rounded-lg hover:bg-gray-100 transition-colors cursor-pointer">
|
||||
className="text-gray-400 hover:text-gray-600 p-1 hover:bg-gray-100 transition-colors cursor-pointer">
|
||||
<svg className="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2.5}>
|
||||
<path strokeLinecap="round" strokeLinejoin="round" d="M6 18 18 6M6 6l12 12" />
|
||||
</svg>
|
||||
@@ -38,7 +38,7 @@ export function Modal({ open, onClose, title, children, footer, width = 'md' }:
|
||||
</div>
|
||||
<div className="px-6 py-5">{children}</div>
|
||||
{footer && (
|
||||
<div className="px-6 py-4 border-t border-gray-100 flex justify-end gap-2">
|
||||
<div className="px-6 py-4 border-t border-divider flex justify-end gap-2">
|
||||
{footer}
|
||||
</div>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user