feat(design): sweep off-system styles and add the check:design gate
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -32,7 +32,7 @@ export default function ForgotPasswordPage() {
|
|||||||
<p className="text-sm text-gray-500">
|
<p className="text-sm text-gray-500">
|
||||||
If an account exists for <strong>{email}</strong>, a password reset link has been sent.
|
If an account exists for <strong>{email}</strong>, a password reset link has been sent.
|
||||||
</p>
|
</p>
|
||||||
<Link href="/login" className="text-sm text-blue-600 hover:underline">
|
<Link href="/login" className="text-sm text-accent-700 hover:underline">
|
||||||
Back to sign in
|
Back to sign in
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
@@ -57,19 +57,19 @@ export default function ForgotPasswordPage() {
|
|||||||
onChange={e => setEmail(e.target.value)}
|
onChange={e => setEmail(e.target.value)}
|
||||||
required
|
required
|
||||||
autoComplete="email"
|
autoComplete="email"
|
||||||
className="border border-divider px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"
|
className="border border-divider px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-accent"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
className="bg-blue-600 hover:bg-blue-700 text-white font-medium py-2 disabled:opacity-50 transition-colors"
|
className="bg-accent hover:bg-accent-600 text-white font-medium py-2 disabled:opacity-50 transition-colors"
|
||||||
>
|
>
|
||||||
{loading ? 'Sending…' : 'Send reset link'}
|
{loading ? 'Sending…' : 'Send reset link'}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<p className="text-center text-sm text-gray-500">
|
<p className="text-center text-sm text-gray-500">
|
||||||
<Link href="/login" className="text-blue-600 hover:underline">
|
<Link href="/login" className="text-accent-700 hover:underline">
|
||||||
Back to sign in
|
Back to sign in
|
||||||
</Link>
|
</Link>
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -8,13 +8,13 @@ interface Props {
|
|||||||
export default async function LoginPage({ searchParams }: Props) {
|
export default async function LoginPage({ searchParams }: Props) {
|
||||||
const { message } = await searchParams
|
const { message } = await searchParams
|
||||||
return (
|
return (
|
||||||
<main className="min-h-screen flex items-center justify-center bg-gray-50 p-4">
|
<main className="min-h-screen flex items-center justify-center bg-ground p-4">
|
||||||
{message === 'password_reset' && (
|
{message === 'password_reset' && (
|
||||||
<div className="fixed top-4 left-1/2 -translate-x-1/2 bg-green-50 border border-green-200 text-green-700 text-sm px-4 py-2 shadow">
|
<div className="fixed top-4 left-1/2 -translate-x-1/2 bg-neutral-100 border border-divider text-ink text-sm px-4 py-2 shadow">
|
||||||
Password updated — sign in with your new password.
|
Password updated — sign in with your new password.
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className="bg-surface shadow-sm border p-8 w-full max-w-sm">
|
<div className="bg-surface border-2 border-divider p-8 w-full max-w-sm">
|
||||||
<LoginForm />
|
<LoginForm />
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ export default function ResetPasswordPage() {
|
|||||||
required
|
required
|
||||||
minLength={8}
|
minLength={8}
|
||||||
autoComplete="new-password"
|
autoComplete="new-password"
|
||||||
className="border border-divider px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"
|
className="border border-divider px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-accent"
|
||||||
/>
|
/>
|
||||||
<input
|
<input
|
||||||
type="password"
|
type="password"
|
||||||
@@ -77,13 +77,13 @@ export default function ResetPasswordPage() {
|
|||||||
onChange={e => setConfirm(e.target.value)}
|
onChange={e => setConfirm(e.target.value)}
|
||||||
required
|
required
|
||||||
autoComplete="new-password"
|
autoComplete="new-password"
|
||||||
className="border border-divider px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"
|
className="border border-divider px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-accent"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
className="bg-blue-600 hover:bg-blue-700 text-white font-medium py-2 disabled:opacity-50 transition-colors"
|
className="bg-accent hover:bg-accent-600 text-white font-medium py-2 disabled:opacity-50 transition-colors"
|
||||||
>
|
>
|
||||||
{loading ? 'Saving…' : 'Set password'}
|
{loading ? 'Saving…' : 'Set password'}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ export default async function AdminHome() {
|
|||||||
<p className="text-sm text-gray-500 mt-0.5">Manage users, sites, zones, and trucks</p>
|
<p className="text-sm text-gray-500 mt-0.5">Manage users, sites, zones, and trucks</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="mb-6 flex gap-3">
|
<div className="mb-6 flex gap-3">
|
||||||
<Link href="/bulk-import" className="px-4 py-2 bg-green-600 text-white text-sm font-medium hover:bg-green-700">
|
<Link href="/bulk-import" className="px-4 py-2 bg-accent text-white text-sm font-medium hover:bg-accent-600">
|
||||||
Bulk Import Incidents
|
Bulk Import Incidents
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ export default async function CapaOwnerPage() {
|
|||||||
<div className="flex-1 min-w-0">
|
<div className="flex-1 min-w-0">
|
||||||
<p className="text-sm text-gray-800">{capa.description}</p>
|
<p className="text-sm text-gray-800">{capa.description}</p>
|
||||||
{capa.incidentRefNo && (
|
{capa.incidentRefNo && (
|
||||||
<Link href={`/hse/incidents/${capa.incidentId}`} className="text-xs text-blue-600 hover:underline mt-0.5 inline-block">
|
<Link href={`/hse/incidents/${capa.incidentId}`} className="text-xs text-accent-700 hover:underline mt-0.5 inline-block">
|
||||||
{capa.incidentRefNo}
|
{capa.incidentRefNo}
|
||||||
</Link>
|
</Link>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ export default async function CapaDetailPage({ params }: Props) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="max-w-2xl mx-auto px-4 py-6">
|
<main className="max-w-2xl mx-auto px-4 py-6">
|
||||||
<Link href="/hse/capa" className="text-sm text-blue-600 hover:underline mb-4 inline-block">
|
<Link href="/hse/capa" className="text-sm text-accent-700 hover:underline mb-4 inline-block">
|
||||||
← CAPA Board
|
← CAPA Board
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ export default async function CapaListPage() {
|
|||||||
<main className="max-w-6xl mx-auto px-4 py-6">
|
<main className="max-w-6xl mx-auto px-4 py-6">
|
||||||
<div className="flex items-center justify-between mb-6">
|
<div className="flex items-center justify-between mb-6">
|
||||||
<h1 className="text-2xl font-bold text-gray-900">CAPA Board</h1>
|
<h1 className="text-2xl font-bold text-gray-900">CAPA Board</h1>
|
||||||
<Link href="/hse/incidents" className="text-sm text-blue-600 hover:underline">
|
<Link href="/hse/incidents" className="text-sm text-accent-700 hover:underline">
|
||||||
← Incidents
|
← Incidents
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ export default async function HseDashboardPage({
|
|||||||
>
|
>
|
||||||
JKKP 8
|
JKKP 8
|
||||||
</a>
|
</a>
|
||||||
<Link href="/hse/incidents" className="text-sm text-blue-600 hover:underline">
|
<Link href="/hse/incidents" className="text-sm text-accent-700 hover:underline">
|
||||||
All incidents →
|
All incidents →
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
@@ -187,8 +187,8 @@ export default async function HseDashboardPage({
|
|||||||
{(tab === 'overview') && (
|
{(tab === 'overview') && (
|
||||||
<>
|
<>
|
||||||
{now.getMonth() === 0 && (
|
{now.getMonth() === 0 && (
|
||||||
<div className="bg-amber-50 border border-amber-200 p-4 mb-6">
|
<div className="bg-accent-100 border border-accent-300 p-4 mb-6">
|
||||||
<p className="text-sm text-amber-800">
|
<p className="text-sm text-accent-700">
|
||||||
<strong>JKKP 8 annual register due:</strong> the {now.getFullYear() - 1} register must be
|
<strong>JKKP 8 annual register due:</strong> the {now.getFullYear() - 1} register must be
|
||||||
submitted to DOSH before 31 January {now.getFullYear()}.{' '}
|
submitted to DOSH before 31 January {now.getFullYear()}.{' '}
|
||||||
<a href={`/api/reports/jkkp8?year=${now.getFullYear() - 1}`} className="underline font-medium">
|
<a href={`/api/reports/jkkp8?year=${now.getFullYear() - 1}`} className="underline font-medium">
|
||||||
@@ -218,18 +218,18 @@ export default async function HseDashboardPage({
|
|||||||
Leading: hazard + near-miss reports (predict risk) · Lagging: injuries (past harm)
|
Leading: hazard + near-miss reports (predict risk) · Lagging: injuries (past harm)
|
||||||
</p>
|
</p>
|
||||||
<div className="flex gap-4">
|
<div className="flex gap-4">
|
||||||
<div className="flex-1 text-center bg-blue-50 p-4">
|
<div className="flex-1 text-center bg-neutral-100 p-4">
|
||||||
<p className="text-3xl font-bold text-blue-600">{leadingCount}</p>
|
<p className="text-3xl font-bold text-accent-700">{leadingCount}</p>
|
||||||
<p className="text-xs text-blue-700 mt-1">Leading (Hazards + Near Misses)</p>
|
<p className="text-xs text-accent-700 mt-1">Leading (Hazards + Near Misses)</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex-1 text-center bg-red-50 p-4">
|
<div className="flex-1 text-center bg-red-50 p-4">
|
||||||
<p className="text-3xl font-bold text-red-600">{laggingCount}</p>
|
<p className="text-3xl font-bold text-red-600">{laggingCount}</p>
|
||||||
<p className="text-xs text-red-700 mt-1">Lagging (Injuries)</p>
|
<p className="text-xs text-red-700 mt-1">Lagging (Injuries)</p>
|
||||||
</div>
|
</div>
|
||||||
{capaOnTimeRate !== null && (
|
{capaOnTimeRate !== null && (
|
||||||
<div className="flex-1 text-center bg-green-50 p-4">
|
<div className="flex-1 text-center bg-neutral-100 p-4">
|
||||||
<p className="text-3xl font-bold text-green-600">{capaOnTimeRate}%</p>
|
<p className="text-3xl font-bold text-ink">{capaOnTimeRate}%</p>
|
||||||
<p className="text-xs text-green-700 mt-1">CAPA On-Time Rate</p>
|
<p className="text-xs text-ink mt-1">CAPA On-Time Rate</p>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@@ -253,7 +253,7 @@ export default async function HseDashboardPage({
|
|||||||
return (
|
return (
|
||||||
<div key={m.month} className="flex-1 flex flex-col items-center gap-1">
|
<div key={m.month} className="flex-1 flex flex-col items-center gap-1">
|
||||||
<div className="w-full flex flex-col-reverse" style={{ height: '192px' }}>
|
<div className="w-full flex flex-col-reverse" style={{ height: '192px' }}>
|
||||||
<div className="w-full bg-blue-400" style={{ height: `${(m.leading / monthlyMax) * 192}px` }} />
|
<div className="w-full bg-accent-400" style={{ height: `${(m.leading / monthlyMax) * 192}px` }} />
|
||||||
<div className="w-full bg-red-400" style={{ height: `${(m.lagging / monthlyMax) * 192}px` }} />
|
<div className="w-full bg-red-400" style={{ height: `${(m.lagging / monthlyMax) * 192}px` }} />
|
||||||
<div className="w-full bg-gray-300" style={{ height: `${(Math.max(0, other) / monthlyMax) * 192}px` }} />
|
<div className="w-full bg-gray-300" style={{ height: `${(Math.max(0, other) / monthlyMax) * 192}px` }} />
|
||||||
</div>
|
</div>
|
||||||
@@ -296,9 +296,9 @@ export default async function HseDashboardPage({
|
|||||||
{by_zone.map(({ name, count }) => (
|
{by_zone.map(({ name, count }) => (
|
||||||
<div key={name} className="flex items-center gap-3">
|
<div key={name} className="flex items-center gap-3">
|
||||||
<span className="text-sm text-gray-600 w-36 shrink-0 truncate">{name}</span>
|
<span className="text-sm text-gray-600 w-36 shrink-0 truncate">{name}</span>
|
||||||
<div className="flex-1 bg-gray-100 rounded-full h-3">
|
<div className="flex-1 bg-gray-100 h-3">
|
||||||
<div
|
<div
|
||||||
className="h-3 rounded-full"
|
className="h-3"
|
||||||
style={{
|
style={{
|
||||||
width: `${(count / zoneMax) * 100}%`,
|
width: `${(count / zoneMax) * 100}%`,
|
||||||
backgroundColor: `hsl(220, 70%, ${Math.max(30, 80 - Math.round((count / zoneMax) * 50))}%)`,
|
backgroundColor: `hsl(220, 70%, ${Math.max(30, 80 - Math.round((count / zoneMax) * 50))}%)`,
|
||||||
@@ -318,9 +318,9 @@ export default async function HseDashboardPage({
|
|||||||
{Object.entries(by_type).sort((a, b) => b[1] - a[1]).map(([type, count]) => (
|
{Object.entries(by_type).sort((a, b) => b[1] - a[1]).map(([type, count]) => (
|
||||||
<div key={type} className="flex items-center gap-3">
|
<div key={type} className="flex items-center gap-3">
|
||||||
<span className="text-sm text-gray-600 w-32 shrink-0">{TYPE_LABELS[type] ?? type}</span>
|
<span className="text-sm text-gray-600 w-32 shrink-0">{TYPE_LABELS[type] ?? type}</span>
|
||||||
<div className="flex-1 bg-gray-100 rounded-full h-2">
|
<div className="flex-1 bg-gray-100 h-2">
|
||||||
<div
|
<div
|
||||||
className="bg-blue-500 h-2 rounded-full"
|
className="bg-accent h-2"
|
||||||
style={{ width: total > 0 ? `${(count / total) * 100}%` : '0%' }}
|
style={{ width: total > 0 ? `${(count / total) * 100}%` : '0%' }}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export default async function NewCapaPage({ params }: Props) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="max-w-lg mx-auto px-4 py-6">
|
<main className="max-w-lg mx-auto px-4 py-6">
|
||||||
<Link href={`/hse/incidents/${id}`} className="text-sm text-blue-600 hover:underline mb-4 inline-block">
|
<Link href={`/hse/incidents/${id}`} className="text-sm text-accent-700 hover:underline mb-4 inline-block">
|
||||||
← Back to incident
|
← Back to incident
|
||||||
</Link>
|
</Link>
|
||||||
<h1 className="text-xl font-bold text-gray-900 mb-1">Add CAPA Action</h1>
|
<h1 className="text-xl font-bold text-gray-900 mb-1">Add CAPA Action</h1>
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export default async function InvestigationPage({ params }: Props) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="max-w-2xl mx-auto px-4 py-6">
|
<main className="max-w-2xl mx-auto px-4 py-6">
|
||||||
<Link href={`/hse/incidents/${id}`} className="text-sm text-blue-600 hover:underline mb-4 inline-block">
|
<Link href={`/hse/incidents/${id}`} className="text-sm text-accent-700 hover:underline mb-4 inline-block">
|
||||||
← Back to incident
|
← Back to incident
|
||||||
</Link>
|
</Link>
|
||||||
<h1 className="text-xl font-bold text-gray-900 mb-1">Investigation Workspace</h1>
|
<h1 className="text-xl font-bold text-gray-900 mb-1">Investigation Workspace</h1>
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ export default async function HseIncidentDetailPage({ params }: Props) {
|
|||||||
href={`/api/incidents/${id}/report-pdf`}
|
href={`/api/incidents/${id}/report-pdf`}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
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"
|
className="flex items-center gap-1.5 px-3 py-1.5 bg-accent text-white text-xs font-semibold hover:bg-accent-600 transition-colors"
|
||||||
>
|
>
|
||||||
<svg className="w-3.5 h-3.5" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}>
|
<svg className="w-3.5 h-3.5" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}>
|
||||||
<path strokeLinecap="round" strokeLinejoin="round" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
|
<path strokeLinecap="round" strokeLinejoin="round" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export default async function TriagePage({ params }: Props) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="max-w-lg mx-auto px-4 py-6">
|
<main className="max-w-lg mx-auto px-4 py-6">
|
||||||
<Link href={`/hse/incidents/${id}`} className="text-sm text-blue-600 hover:underline mb-4 inline-block">
|
<Link href={`/hse/incidents/${id}`} className="text-sm text-accent-700 hover:underline mb-4 inline-block">
|
||||||
← Back to incident
|
← Back to incident
|
||||||
</Link>
|
</Link>
|
||||||
<h1 className="text-xl font-bold text-gray-900 mb-1">Triage Incident</h1>
|
<h1 className="text-xl font-bold text-gray-900 mb-1">Triage Incident</h1>
|
||||||
|
|||||||
@@ -123,9 +123,9 @@ export default async function ManagementPage() {
|
|||||||
<h2 className="text-sm font-semibold text-gray-700 uppercase tracking-wide mb-1">Leading vs Lagging — Last 30 Days</h2>
|
<h2 className="text-sm font-semibold text-gray-700 uppercase tracking-wide mb-1">Leading vs Lagging — Last 30 Days</h2>
|
||||||
<p className="text-xs text-gray-400 mb-4">Leading: hazard + near-miss · Lagging: injuries</p>
|
<p className="text-xs text-gray-400 mb-4">Leading: hazard + near-miss · Lagging: injuries</p>
|
||||||
<div className="flex gap-6">
|
<div className="flex gap-6">
|
||||||
<div className="flex-1 text-center bg-blue-50 p-4">
|
<div className="flex-1 text-center bg-neutral-100 p-4">
|
||||||
<p className="text-3xl font-bold text-blue-600">{leadingCount}</p>
|
<p className="text-3xl font-bold text-accent-700">{leadingCount}</p>
|
||||||
<p className="text-xs text-blue-700 mt-1">Leading (Hazards + Near Misses)</p>
|
<p className="text-xs text-accent-700 mt-1">Leading (Hazards + Near Misses)</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex-1 text-center bg-red-50 p-4">
|
<div className="flex-1 text-center bg-red-50 p-4">
|
||||||
<p className="text-3xl font-bold text-red-600">{laggingCount}</p>
|
<p className="text-3xl font-bold text-red-600">{laggingCount}</p>
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ export default async function ReporterIncidentDetail({
|
|||||||
return (
|
return (
|
||||||
<main className="max-w-2xl mx-auto px-4 py-6 space-y-4">
|
<main className="max-w-2xl mx-auto px-4 py-6 space-y-4">
|
||||||
<div className="flex items-center gap-2 mb-2">
|
<div className="flex items-center gap-2 mb-2">
|
||||||
<Link href="/reporter" className="text-sm text-blue-600 hover:underline">← My Reports</Link>
|
<Link href="/reporter" className="text-sm text-accent-700 hover:underline">← My Reports</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="bg-surface shadow-sm p-5">
|
<div className="bg-surface shadow-sm p-5">
|
||||||
@@ -105,9 +105,9 @@ export default async function ReporterIncidentDetail({
|
|||||||
{capas.map(c => (
|
{capas.map(c => (
|
||||||
<div key={c.id} className="flex items-start justify-between gap-3 text-sm">
|
<div key={c.id} className="flex items-start justify-between gap-3 text-sm">
|
||||||
<p className="text-gray-700 flex-1">{c.description}</p>
|
<p className="text-gray-700 flex-1">{c.description}</p>
|
||||||
<span className={`text-xs rounded-full px-2 py-0.5 shrink-0 ${
|
<span className={`text-xs px-2 py-0.5 shrink-0 ${
|
||||||
c.status === 'verified' ? 'bg-green-100 text-green-700' :
|
c.status === 'verified' ? 'bg-neutral-100 text-ink' :
|
||||||
c.status === 'pending_verification' ? 'bg-purple-100 text-purple-700' :
|
c.status === 'pending_verification' ? 'bg-accent-100 text-accent-700' :
|
||||||
'bg-gray-100 text-gray-600'
|
'bg-gray-100 text-gray-600'
|
||||||
}`}>{c.status.replace(/_/g, ' ')}</span>
|
}`}>{c.status.replace(/_/g, ' ')}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ export default async function ReporterPage() {
|
|||||||
</div>
|
</div>
|
||||||
<Link
|
<Link
|
||||||
href="/report"
|
href="/report"
|
||||||
className="bg-blue-600 text-white px-4 py-2 text-sm font-semibold hover:bg-blue-700"
|
className="bg-accent text-white px-4 py-2 text-sm font-semibold hover:bg-accent-600"
|
||||||
>
|
>
|
||||||
+ New Report
|
+ New Report
|
||||||
</Link>
|
</Link>
|
||||||
@@ -66,11 +66,11 @@ export default async function ReporterPage() {
|
|||||||
<p className="text-xs text-gray-500 mt-1">Total Submitted</p>
|
<p className="text-xs text-gray-500 mt-1">Total Submitted</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="bg-surface shadow-sm p-4 flex-1 text-center">
|
<div className="bg-surface shadow-sm p-4 flex-1 text-center">
|
||||||
<p className="text-2xl font-bold text-yellow-600">{openCount}</p>
|
<p className="text-2xl font-bold text-accent-700">{openCount}</p>
|
||||||
<p className="text-xs text-gray-500 mt-1">In Progress</p>
|
<p className="text-xs text-gray-500 mt-1">In Progress</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="bg-surface shadow-sm p-4 flex-1 text-center">
|
<div className="bg-surface shadow-sm p-4 flex-1 text-center">
|
||||||
<p className="text-2xl font-bold text-green-600">{closedCount}</p>
|
<p className="text-2xl font-bold text-ink">{closedCount}</p>
|
||||||
<p className="text-xs text-gray-500 mt-1">Closed</p>
|
<p className="text-xs text-gray-500 mt-1">Closed</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -78,7 +78,7 @@ export default async function ReporterPage() {
|
|||||||
{rows.length === 0 ? (
|
{rows.length === 0 ? (
|
||||||
<div className="bg-surface shadow-sm p-8 text-center">
|
<div className="bg-surface shadow-sm p-8 text-center">
|
||||||
<p className="text-gray-400 text-sm mb-4">No incidents reported yet.</p>
|
<p className="text-gray-400 text-sm mb-4">No incidents reported yet.</p>
|
||||||
<Link href="/report" className="text-blue-600 text-sm hover:underline">Submit your first report →</Link>
|
<Link href="/report" className="text-accent-700 text-sm hover:underline">Submit your first report →</Link>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="bg-surface shadow-sm divide-y divide-gray-50">
|
<div className="bg-surface shadow-sm divide-y divide-gray-50">
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ export default async function SupervisorIncidentDetailPage({ params }: Props) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="max-w-3xl mx-auto px-4 py-6">
|
<main className="max-w-3xl mx-auto px-4 py-6">
|
||||||
<Link href="/supervisor/incidents" className="text-sm text-blue-600 hover:underline mb-4 inline-block">
|
<Link href="/supervisor/incidents" className="text-sm text-accent-700 hover:underline mb-4 inline-block">
|
||||||
← Back to inbox
|
← Back to inbox
|
||||||
</Link>
|
</Link>
|
||||||
<IncidentDetail incident={incidentProp} />
|
<IncidentDetail incident={incidentProp} />
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ export default async function SupervisorPage() {
|
|||||||
<h1 className="text-2xl font-bold text-gray-900">Supervisor Portal</h1>
|
<h1 className="text-2xl font-bold text-gray-900">Supervisor Portal</h1>
|
||||||
<p className="text-sm text-gray-500 mt-1">{siteName}</p>
|
<p className="text-sm text-gray-500 mt-1">{siteName}</p>
|
||||||
</div>
|
</div>
|
||||||
<Link href="/supervisor/incidents" className="text-sm text-blue-600 hover:underline">
|
<Link href="/supervisor/incidents" className="text-sm text-accent-700 hover:underline">
|
||||||
All incidents →
|
All incidents →
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -71,6 +71,19 @@
|
|||||||
--color-blue-900: var(--color-accent-900);
|
--color-blue-900: var(--color-accent-900);
|
||||||
--color-blue-950: var(--color-accent-900);
|
--color-blue-950: var(--color-accent-900);
|
||||||
|
|
||||||
|
/* Existing red-* utilities (errors, destructive) render on the accent ramp;
|
||||||
|
600 and 700 map to accent-700 so body-size text clears contrast. */
|
||||||
|
--color-red-50: var(--color-accent-100);
|
||||||
|
--color-red-100: var(--color-accent-100);
|
||||||
|
--color-red-200: var(--color-accent-200);
|
||||||
|
--color-red-300: var(--color-accent-300);
|
||||||
|
--color-red-400: var(--color-accent-400);
|
||||||
|
--color-red-500: var(--color-accent-600);
|
||||||
|
--color-red-600: var(--color-accent-700);
|
||||||
|
--color-red-700: var(--color-accent-700);
|
||||||
|
--color-red-800: var(--color-accent-800);
|
||||||
|
--color-red-900: var(--color-accent-900);
|
||||||
|
|
||||||
/* Zero corner radius, everywhere. */
|
/* Zero corner radius, everywhere. */
|
||||||
--radius: 0px;
|
--radius: 0px;
|
||||||
--radius-xs: 0px;
|
--radius-xs: 0px;
|
||||||
|
|||||||
+1
-1
@@ -67,7 +67,7 @@ export default async function ReportPage({ searchParams }: Props) {
|
|||||||
{siteName ?? 'Unknown Site'} — {zoneName}
|
{siteName ?? 'Unknown Site'} — {zoneName}
|
||||||
</p>
|
</p>
|
||||||
) : (
|
) : (
|
||||||
<p className="text-sm text-amber-600 mt-1">No zone detected — zone will not be recorded</p>
|
<p className="text-sm text-accent-700 mt-1">No zone detected — zone will not be recorded</p>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<ReportForm
|
<ReportForm
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export default async function ReportSuccessPage({ searchParams }: Props) {
|
|||||||
<p className="text-sm text-gray-500 mb-6">
|
<p className="text-sm text-gray-500 mb-6">
|
||||||
The supervisor and HSE officer have been notified.
|
The supervisor and HSE officer have been notified.
|
||||||
</p>
|
</p>
|
||||||
<Link href="/report" className="text-sm text-blue-600 hover:underline">
|
<Link href="/report" className="text-sm text-accent-700 hover:underline">
|
||||||
Submit another report
|
Submit another report
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ export default function ChangePasswordForm() {
|
|||||||
onChange={e => setCurrent(e.target.value)}
|
onChange={e => setCurrent(e.target.value)}
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
autoComplete="current-password"
|
autoComplete="current-password"
|
||||||
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"
|
className="w-full border border-divider px-3 py-2 text-sm focus:ring-2 focus:ring-accent focus:border-transparent disabled:opacity-50"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@@ -80,7 +80,7 @@ export default function ChangePasswordForm() {
|
|||||||
onChange={e => setNewPass(e.target.value)}
|
onChange={e => setNewPass(e.target.value)}
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
autoComplete="new-password"
|
autoComplete="new-password"
|
||||||
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"
|
className="w-full border border-divider px-3 py-2 text-sm focus:ring-2 focus:ring-accent focus:border-transparent disabled:opacity-50"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@@ -93,17 +93,17 @@ export default function ChangePasswordForm() {
|
|||||||
onChange={e => setConfirm(e.target.value)}
|
onChange={e => setConfirm(e.target.value)}
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
autoComplete="new-password"
|
autoComplete="new-password"
|
||||||
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"
|
className="w-full border border-divider px-3 py-2 text-sm focus:ring-2 focus:ring-accent focus:border-transparent disabled:opacity-50"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{error && <p className="text-xs text-red-600 mt-1">{error}</p>}
|
{error && <p className="text-xs text-red-600 mt-1">{error}</p>}
|
||||||
{success && <p className="text-xs text-green-600 mt-1">Password changed successfully.</p>}
|
{success && <p className="text-xs text-ink mt-1">Password changed successfully.</p>}
|
||||||
|
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
className="bg-blue-600 text-white px-4 py-2 text-sm font-semibold disabled:opacity-50 hover:bg-blue-700"
|
className="bg-accent text-white px-4 py-2 text-sm font-semibold disabled:opacity-50 hover:bg-accent-600"
|
||||||
>
|
>
|
||||||
{loading ? 'Saving…' : 'Update Password'}
|
{loading ? 'Saving…' : 'Update Password'}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -32,13 +32,13 @@ export function AdminPanel({ users, sites, siteOptions, trucks }: Props) {
|
|||||||
onClick={() => setTab(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 ${
|
className={`px-4 py-2.5 text-sm font-medium border-b-2 -mb-px transition-colors cursor-pointer ${
|
||||||
tab === t.id
|
tab === t.id
|
||||||
? 'border-green-600 text-green-700'
|
? 'border-accent text-ink'
|
||||||
: 'border-transparent text-gray-500 hover:text-gray-700'
|
: 'border-transparent text-gray-500 hover:text-gray-700'
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
{t.label}
|
{t.label}
|
||||||
<span className={`ml-1.5 text-xs px-1.5 py-0.5 rounded-full ${
|
<span className={`ml-1.5 text-xs px-1.5 py-0.5 ${
|
||||||
tab === t.id ? 'bg-green-100 text-green-700' : 'bg-gray-100 text-gray-500'
|
tab === t.id ? 'bg-neutral-100 text-ink' : 'bg-gray-100 text-gray-500'
|
||||||
}`}>{t.count}</span>
|
}`}>{t.count}</span>
|
||||||
</button>
|
</button>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -208,7 +208,7 @@ export function BulkImportForm() {
|
|||||||
<button
|
<button
|
||||||
onClick={handleImport}
|
onClick={handleImport}
|
||||||
disabled={!canImport || loading}
|
disabled={!canImport || loading}
|
||||||
className="px-4 py-2 bg-blue-600 text-white disabled:opacity-50 disabled:cursor-not-allowed"
|
className="px-4 py-2 bg-accent text-white disabled:opacity-50 disabled:cursor-not-allowed"
|
||||||
>
|
>
|
||||||
{loading ? 'Importing...' : 'Import All'}
|
{loading ? 'Importing...' : 'Import All'}
|
||||||
</button>
|
</button>
|
||||||
@@ -220,9 +220,9 @@ export function BulkImportForm() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<h3 className="font-bold text-green-600">✓ Import Complete</h3>
|
<h3 className="font-bold text-ink">✓ Import Complete</h3>
|
||||||
<p>{folders.length} incidents created</p>
|
<p>{folders.length} incidents created</p>
|
||||||
{message && <p className="text-green-600 text-sm">{message}</p>}
|
{message && <p className="text-ink text-sm">{message}</p>}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { useRouter } from 'next/navigation'
|
import { useRouter } from 'next/navigation'
|
||||||
import { Modal } from '@/components/ui/modal'
|
import { Modal } from '@/components/ui/modal'
|
||||||
|
import { INPUT_CLASS as inp } from '@/components/ui/field'
|
||||||
|
|
||||||
export type SiteWithZones = {
|
export type SiteWithZones = {
|
||||||
id: string
|
id: string
|
||||||
@@ -16,7 +17,6 @@ interface Props {
|
|||||||
sites: SiteWithZones[]
|
sites: SiteWithZones[]
|
||||||
}
|
}
|
||||||
|
|
||||||
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'
|
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 }
|
type DeleteTarget = { kind: 'site'; id: string; name: string } | { kind: 'zone'; id: string; name: string }
|
||||||
@@ -96,7 +96,7 @@ export function SiteZoneManager({ sites }: Props) {
|
|||||||
Add Zone
|
Add Zone
|
||||||
</button>
|
</button>
|
||||||
<button onClick={() => { setShowAddSite(true); setError(null) }}
|
<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 hover:bg-green-700 transition-colors cursor-pointer">
|
className="flex items-center gap-1.5 px-3 py-1.5 bg-accent text-white text-xs font-semibold hover:bg-accent-600 transition-colors cursor-pointer">
|
||||||
<svg className="w-3.5 h-3.5" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2.5}>
|
<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" />
|
<path strokeLinecap="round" strokeLinejoin="round" d="M12 4v16m8-8H4" />
|
||||||
</svg>
|
</svg>
|
||||||
@@ -118,9 +118,9 @@ export function SiteZoneManager({ sites }: Props) {
|
|||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<button disabled={busyId === site.id}
|
<button disabled={busyId === site.id}
|
||||||
onClick={() => send('PATCH', { kind: 'site', id: site.id, active: !site.active })}
|
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 ${
|
className={`text-xs font-medium px-2.5 py-1 border transition-colors cursor-pointer disabled:opacity-50 ${
|
||||||
site.active
|
site.active
|
||||||
? 'bg-green-50 text-green-700 border-green-200 hover:bg-green-100'
|
? 'bg-neutral-100 text-ink border-divider hover:bg-neutral-200'
|
||||||
: 'bg-gray-50 text-gray-500 border-divider hover:bg-gray-100'
|
: 'bg-gray-50 text-gray-500 border-divider hover:bg-gray-100'
|
||||||
}`}>
|
}`}>
|
||||||
{site.active ? 'Active' : 'Inactive'}
|
{site.active ? 'Active' : 'Inactive'}
|
||||||
@@ -140,14 +140,14 @@ export function SiteZoneManager({ sites }: Props) {
|
|||||||
<span className="text-xs text-gray-700 font-medium">{z.name}</span>
|
<span className="text-xs text-gray-700 font-medium">{z.name}</span>
|
||||||
<div className="flex items-center gap-3">
|
<div className="flex items-center gap-3">
|
||||||
<a href={`/report?zone=${z.qr_code_token}`} target="_blank"
|
<a href={`/report?zone=${z.qr_code_token}`} target="_blank"
|
||||||
className="text-xs text-blue-600 hover:underline cursor-pointer">
|
className="text-xs text-accent-700 hover:underline cursor-pointer">
|
||||||
Report link
|
Report link
|
||||||
</a>
|
</a>
|
||||||
<button disabled={busyId === z.id}
|
<button disabled={busyId === z.id}
|
||||||
onClick={() => send('PATCH', { kind: 'zone', id: z.id, active: !z.active })}
|
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 ${
|
className={`text-xs font-medium px-2 py-0.5 border transition-colors cursor-pointer disabled:opacity-50 ${
|
||||||
z.active
|
z.active
|
||||||
? 'bg-green-50 text-green-700 border-green-200 hover:bg-green-100'
|
? 'bg-neutral-100 text-ink border-divider hover:bg-neutral-200'
|
||||||
: 'bg-gray-50 text-gray-500 border-divider hover:bg-gray-100'
|
: 'bg-gray-50 text-gray-500 border-divider hover:bg-gray-100'
|
||||||
}`}>
|
}`}>
|
||||||
{z.active ? 'Active' : 'Inactive'}
|
{z.active ? 'Active' : 'Inactive'}
|
||||||
@@ -183,7 +183,7 @@ export function SiteZoneManager({ sites }: Props) {
|
|||||||
</button>
|
</button>
|
||||||
<button disabled={busy || !siteName.trim()}
|
<button disabled={busy || !siteName.trim()}
|
||||||
onClick={async () => { if (await post({ kind: 'site', name: siteName })) { setSiteName(''); setShowAddSite(false) } }}
|
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 hover:bg-green-700 disabled:opacity-50 cursor-pointer transition-colors">
|
className="px-4 py-2 bg-accent text-white text-sm font-semibold hover:bg-accent-600 disabled:opacity-50 cursor-pointer transition-colors">
|
||||||
{busy ? 'Adding…' : 'Add Site'}
|
{busy ? 'Adding…' : 'Add Site'}
|
||||||
</button>
|
</button>
|
||||||
</>
|
</>
|
||||||
@@ -214,7 +214,7 @@ export function SiteZoneManager({ sites }: Props) {
|
|||||||
setZoneName(''); setZoneSiteId(''); setShowAddZone(false)
|
setZoneName(''); setZoneSiteId(''); setShowAddZone(false)
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
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">
|
className="px-4 py-2 bg-accent text-white text-sm font-semibold hover:bg-accent-600 disabled:opacity-50 cursor-pointer transition-colors">
|
||||||
{busy ? 'Adding…' : 'Add Zone'}
|
{busy ? 'Adding…' : 'Add Zone'}
|
||||||
</button>
|
</button>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { useRouter } from 'next/navigation'
|
import { useRouter } from 'next/navigation'
|
||||||
import { Modal } from '@/components/ui/modal'
|
import { Modal } from '@/components/ui/modal'
|
||||||
|
import { INPUT_CLASS as inp } from '@/components/ui/field'
|
||||||
|
|
||||||
export type Truck = {
|
export type Truck = {
|
||||||
id: string
|
id: string
|
||||||
@@ -15,7 +16,6 @@ interface Props {
|
|||||||
trucks: Truck[]
|
trucks: Truck[]
|
||||||
}
|
}
|
||||||
|
|
||||||
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'
|
const lbl = 'block text-xs font-medium text-gray-600 mb-1'
|
||||||
|
|
||||||
export function TruckManager({ trucks }: Props) {
|
export function TruckManager({ trucks }: Props) {
|
||||||
@@ -90,7 +90,7 @@ export function TruckManager({ trucks }: Props) {
|
|||||||
<p className="text-xs text-gray-400 mt-0.5">{trucks.length} vehicle{trucks.length !== 1 ? 's' : ''}</p>
|
<p className="text-xs text-gray-400 mt-0.5">{trucks.length} vehicle{trucks.length !== 1 ? 's' : ''}</p>
|
||||||
</div>
|
</div>
|
||||||
<button onClick={() => { setShowAdd(true); setError(null) }}
|
<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 hover:bg-green-700 transition-colors cursor-pointer">
|
className="flex items-center gap-1.5 px-3 py-1.5 bg-accent text-white text-xs font-semibold hover:bg-accent-600 transition-colors cursor-pointer">
|
||||||
<svg className="w-3.5 h-3.5" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2.5}>
|
<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" />
|
<path strokeLinecap="round" strokeLinejoin="round" d="M12 4v16m8-8H4" />
|
||||||
</svg>
|
</svg>
|
||||||
@@ -109,14 +109,14 @@ export function TruckManager({ trucks }: Props) {
|
|||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-3">
|
<div className="flex items-center gap-3">
|
||||||
<a href={`/report?truck_id=${tk.id}`} target="_blank"
|
<a href={`/report?truck_id=${tk.id}`} target="_blank"
|
||||||
className="text-xs text-blue-600 hover:underline cursor-pointer">
|
className="text-xs text-accent-700 hover:underline cursor-pointer">
|
||||||
Report link
|
Report link
|
||||||
</a>
|
</a>
|
||||||
<button disabled={busyId === tk.id}
|
<button disabled={busyId === tk.id}
|
||||||
onClick={() => send('PATCH', { id: tk.id, active: !tk.active })}
|
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 ${
|
className={`text-xs font-medium px-2.5 py-1 border transition-colors cursor-pointer disabled:opacity-50 ${
|
||||||
tk.active
|
tk.active
|
||||||
? 'bg-green-50 text-green-700 border-green-200 hover:bg-green-100'
|
? 'bg-neutral-100 text-ink border-divider hover:bg-neutral-200'
|
||||||
: 'bg-gray-50 text-gray-500 border-divider hover:bg-gray-100'
|
: 'bg-gray-50 text-gray-500 border-divider hover:bg-gray-100'
|
||||||
}`}>
|
}`}>
|
||||||
{tk.active ? 'Active' : 'Inactive'}
|
{tk.active ? 'Active' : 'Inactive'}
|
||||||
@@ -143,7 +143,7 @@ export function TruckManager({ trucks }: Props) {
|
|||||||
Cancel
|
Cancel
|
||||||
</button>
|
</button>
|
||||||
<button disabled={submitting || !truckNo.trim()} onClick={handleAdd}
|
<button disabled={submitting || !truckNo.trim()} onClick={handleAdd}
|
||||||
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">
|
className="px-4 py-2 bg-accent text-white text-sm font-semibold hover:bg-accent-600 disabled:opacity-50 cursor-pointer transition-colors">
|
||||||
{submitting ? 'Adding…' : 'Add Truck'}
|
{submitting ? 'Adding…' : 'Add Truck'}
|
||||||
</button>
|
</button>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { useState } from 'react'
|
|||||||
import { useRouter } from 'next/navigation'
|
import { useRouter } from 'next/navigation'
|
||||||
import { ALL_ROLES, type UserRole } from '@/lib/auth/roles'
|
import { ALL_ROLES, type UserRole } from '@/lib/auth/roles'
|
||||||
import { Modal } from '@/components/ui/modal'
|
import { Modal } from '@/components/ui/modal'
|
||||||
|
import { INPUT_CLASS as inp } from '@/components/ui/field'
|
||||||
|
|
||||||
export type AdminUser = {
|
export type AdminUser = {
|
||||||
id: string
|
id: string
|
||||||
@@ -24,7 +25,6 @@ interface Props {
|
|||||||
|
|
||||||
const EMPTY = { email: '', name: '', phone: '', role: 'reporter' as UserRole, site_id: '', password: '' }
|
const EMPTY = { email: '', name: '', phone: '', role: 'reporter' as UserRole, site_id: '', password: '' }
|
||||||
|
|
||||||
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'
|
const lbl = 'block text-xs font-medium text-gray-600 mb-1'
|
||||||
|
|
||||||
export function UserManager({ users, sites }: Props) {
|
export function UserManager({ users, sites }: Props) {
|
||||||
@@ -103,7 +103,7 @@ export function UserManager({ users, sites }: Props) {
|
|||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
onClick={() => { setShowAdd(true); setError(null) }}
|
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 hover:bg-green-700 transition-colors cursor-pointer"
|
className="flex items-center gap-1.5 px-3 py-1.5 bg-accent text-white text-xs font-semibold hover:bg-accent-600 transition-colors cursor-pointer"
|
||||||
>
|
>
|
||||||
<svg className="w-3.5 h-3.5" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2.5}>
|
<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" />
|
<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">
|
<td className="px-5 py-3">
|
||||||
<select value={u.role} disabled={busyId === u.id}
|
<select value={u.role} disabled={busyId === u.id}
|
||||||
onChange={e => patchUser(u.id, { role: e.target.value })}
|
onChange={e => patchUser(u.id, { role: e.target.value })}
|
||||||
className="border border-divider 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-accent cursor-pointer">
|
||||||
{ALL_ROLES.map(r => <option key={r} value={r}>{r.replace(/_/g, ' ')}</option>)}
|
{ALL_ROLES.map(r => <option key={r} value={r}>{r.replace(/_/g, ' ')}</option>)}
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
<td className="px-5 py-3">
|
<td className="px-5 py-3">
|
||||||
<select value={u.site_id ?? ''} disabled={busyId === u.id}
|
<select value={u.site_id ?? ''} disabled={busyId === u.id}
|
||||||
onChange={e => patchUser(u.id, { site_id: e.target.value || null })}
|
onChange={e => patchUser(u.id, { site_id: e.target.value || null })}
|
||||||
className="border border-divider 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-accent cursor-pointer">
|
||||||
<option value="">No site</option>
|
<option value="">No site</option>
|
||||||
{sites.map(s => <option key={s.id} value={s.id}>{s.name}</option>)}
|
{sites.map(s => <option key={s.id} value={s.id}>{s.name}</option>)}
|
||||||
</select>
|
</select>
|
||||||
@@ -149,9 +149,9 @@ export function UserManager({ users, sites }: Props) {
|
|||||||
<td className="px-5 py-3">
|
<td className="px-5 py-3">
|
||||||
<button disabled={busyId === u.id}
|
<button disabled={busyId === u.id}
|
||||||
onClick={() => patchUser(u.id, { active: !u.active })}
|
onClick={() => patchUser(u.id, { active: !u.active })}
|
||||||
className={`text-xs px-2.5 py-1 rounded-full font-medium border transition-colors cursor-pointer ${
|
className={`text-xs px-2.5 py-1 font-medium border transition-colors cursor-pointer ${
|
||||||
u.active
|
u.active
|
||||||
? 'bg-green-50 text-green-700 border-green-200 hover:bg-green-100'
|
? 'bg-neutral-100 text-ink border-divider hover:bg-neutral-200'
|
||||||
: 'bg-gray-50 text-gray-500 border-divider hover:bg-gray-100'
|
: 'bg-gray-50 text-gray-500 border-divider hover:bg-gray-100'
|
||||||
}`}>
|
}`}>
|
||||||
{u.active ? 'Active' : 'Inactive'}
|
{u.active ? 'Active' : 'Inactive'}
|
||||||
@@ -182,7 +182,7 @@ export function UserManager({ users, sites }: Props) {
|
|||||||
Cancel
|
Cancel
|
||||||
</button>
|
</button>
|
||||||
<button form="add-user-form" type="submit" disabled={submitting}
|
<button form="add-user-form" type="submit" disabled={submitting}
|
||||||
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">
|
className="px-4 py-2 bg-accent text-white text-sm font-semibold hover:bg-accent-600 disabled:opacity-50 cursor-pointer transition-colors">
|
||||||
{submitting ? 'Adding…' : 'Add User'}
|
{submitting ? 'Adding…' : 'Add User'}
|
||||||
</button>
|
</button>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { useRouter } from 'next/navigation'
|
import { useRouter } from 'next/navigation'
|
||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
|
import { Button } from '@/components/ui/button'
|
||||||
|
import { Input } from '@/components/ui/field'
|
||||||
|
|
||||||
export function LoginForm() {
|
export function LoginForm() {
|
||||||
const [email, setEmail] = useState('')
|
const [email, setEmail] = useState('')
|
||||||
@@ -37,44 +39,38 @@ export function LoginForm() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<form onSubmit={handleSubmit} className="flex flex-col gap-4 w-full max-w-sm">
|
<form onSubmit={handleSubmit} className="flex flex-col gap-4 w-full max-w-sm">
|
||||||
<div className="text-center">
|
<div className="pb-3 border-b-2 border-divider">
|
||||||
<h1 className="text-2xl font-bold">IMS</h1>
|
<h1 className="text-3xl font-extrabold">IMS</h1>
|
||||||
<p className="text-sm text-gray-500 mt-1">HSE Incident Management</p>
|
<p className="text-sm text-ink/60 mt-1">HSE Incident Management</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{error && (
|
{error && (
|
||||||
<p className="bg-red-50 border border-red-200 text-red-700 text-sm px-3 py-2">
|
<p className="bg-accent-100 border border-accent text-accent-800 text-sm px-3 py-2">
|
||||||
{error}
|
{error}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<input
|
<Input
|
||||||
type="email"
|
type="email"
|
||||||
placeholder="Email"
|
placeholder="Email"
|
||||||
value={email}
|
value={email}
|
||||||
onChange={(e) => setEmail(e.target.value)}
|
onChange={(e) => setEmail(e.target.value)}
|
||||||
required
|
required
|
||||||
autoComplete="email"
|
autoComplete="email"
|
||||||
className="border px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"
|
|
||||||
/>
|
/>
|
||||||
<input
|
<Input
|
||||||
type="password"
|
type="password"
|
||||||
placeholder="Password"
|
placeholder="Password"
|
||||||
value={password}
|
value={password}
|
||||||
onChange={(e) => setPassword(e.target.value)}
|
onChange={(e) => setPassword(e.target.value)}
|
||||||
required
|
required
|
||||||
autoComplete="current-password"
|
autoComplete="current-password"
|
||||||
className="border px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"
|
|
||||||
/>
|
/>
|
||||||
<button
|
<Button type="submit" variant="primary" block disabled={loading}>
|
||||||
type="submit"
|
|
||||||
disabled={loading}
|
|
||||||
className="bg-blue-600 hover:bg-blue-700 text-white font-medium py-2 disabled:opacity-50 transition-colors"
|
|
||||||
>
|
|
||||||
{loading ? 'Signing in…' : 'Sign in'}
|
{loading ? 'Signing in…' : 'Sign in'}
|
||||||
</button>
|
</Button>
|
||||||
<p className="text-center text-sm text-gray-500">
|
<p className="text-sm text-ink/60">
|
||||||
<Link href="/forgot-password" className="text-blue-600 hover:underline">
|
<Link href="/forgot-password" className="text-accent-700 hover:underline">
|
||||||
Forgot password?
|
Forgot password?
|
||||||
</Link>
|
</Link>
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ export function CapaBoard({ capas }: Props) {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div className="flex justify-end mb-3">
|
<div className="flex justify-end mb-3">
|
||||||
<button onClick={() => setView('board')} className="text-sm text-blue-600 hover:underline">Board view</button>
|
<button onClick={() => setView('board')} className="text-sm text-accent-700 hover:underline">Board view</button>
|
||||||
</div>
|
</div>
|
||||||
<div className="overflow-x-auto">
|
<div className="overflow-x-auto">
|
||||||
<table className="w-full text-sm">
|
<table className="w-full text-sm">
|
||||||
@@ -75,7 +75,7 @@ export function CapaBoard({ capas }: Props) {
|
|||||||
{(c.incidents as { reference_no: string | null } | null)?.reference_no ?? '—'}
|
{(c.incidents as { reference_no: string | null } | null)?.reference_no ?? '—'}
|
||||||
</td>
|
</td>
|
||||||
<td className="py-2 pr-4">
|
<td className="py-2 pr-4">
|
||||||
<Link href={`/hse/capa/${c.id}`} className="text-blue-600 hover:underline line-clamp-2">
|
<Link href={`/hse/capa/${c.id}`} className="text-accent-700 hover:underline line-clamp-2">
|
||||||
{c.description}
|
{c.description}
|
||||||
</Link>
|
</Link>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ export function CapaForm({ incidentId }: Props) {
|
|||||||
{error && <p className="text-sm text-red-600">{error}</p>}
|
{error && <p className="text-sm text-red-600">{error}</p>}
|
||||||
|
|
||||||
<button type="submit" disabled={saving}
|
<button type="submit" disabled={saving}
|
||||||
className="w-full bg-amber-600 text-white py-2 text-sm font-semibold disabled:opacity-50">
|
className="w-full bg-accent text-white py-2 text-sm font-semibold disabled:opacity-50">
|
||||||
{saving ? 'Creating…' : 'Create CAPA Action'}
|
{saving ? 'Creating…' : 'Create CAPA Action'}
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ export function CapaOwnerActions({ capaId, currentStatus }: Props) {
|
|||||||
<button
|
<button
|
||||||
onClick={() => updateStatus('pending_verification')}
|
onClick={() => updateStatus('pending_verification')}
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
className="text-sm px-3 py-1.5 bg-blue-600 text-white hover:bg-blue-700 disabled:opacity-50"
|
className="text-sm px-3 py-1.5 bg-accent text-white hover:bg-accent-600 disabled:opacity-50"
|
||||||
>
|
>
|
||||||
{loading ? '…' : 'Submit for Verification'}
|
{loading ? '…' : 'Submit for Verification'}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ export function CapaOwnerNotesForm({ capaId, initialNotes }: Props) {
|
|||||||
onChange={e => { setNotes(e.target.value); setSaved(false) }}
|
onChange={e => { setNotes(e.target.value); setSaved(false) }}
|
||||||
rows={2}
|
rows={2}
|
||||||
placeholder="Add any notes or updates for this action…"
|
placeholder="Add any notes or updates for this action…"
|
||||||
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"
|
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-accent"
|
||||||
/>
|
/>
|
||||||
{error && <p className="text-xs text-red-600">{error}</p>}
|
{error && <p className="text-xs text-red-600">{error}</p>}
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
@@ -50,7 +50,7 @@ export function CapaOwnerNotesForm({ capaId, initialNotes }: Props) {
|
|||||||
>
|
>
|
||||||
{saving ? 'Saving…' : 'Save Notes'}
|
{saving ? 'Saving…' : 'Save Notes'}
|
||||||
</button>
|
</button>
|
||||||
{saved && <span className="text-xs text-green-600">Saved</span>}
|
{saved && <span className="text-xs text-ink">Saved</span>}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export function CloseCapaButton({ capaId }: Props) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="border border-divider p-5 space-y-3 bg-green-50">
|
<div className="border border-divider p-5 space-y-3 bg-neutral-100">
|
||||||
<h3 className="text-sm font-semibold text-gray-800">Close CAPA</h3>
|
<h3 className="text-sm font-semibold text-gray-800">Close CAPA</h3>
|
||||||
<p className="text-sm text-gray-600">
|
<p className="text-sm text-gray-600">
|
||||||
This CAPA has been verified as effective. Close it to mark it fully resolved.
|
This CAPA has been verified as effective. Close it to mark it fully resolved.
|
||||||
@@ -40,7 +40,7 @@ export function CloseCapaButton({ capaId }: Props) {
|
|||||||
<button
|
<button
|
||||||
onClick={handleClose}
|
onClick={handleClose}
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
className="w-full bg-green-700 text-white py-2 text-sm font-semibold hover:bg-green-800 disabled:opacity-50"
|
className="w-full bg-accent text-white py-2 text-sm font-semibold hover:bg-accent-700 disabled:opacity-50"
|
||||||
>
|
>
|
||||||
{loading ? 'Closing…' : 'Close CAPA'}
|
{loading ? 'Closing…' : 'Close CAPA'}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ export function VerifyForm({ capaId }: Props) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<form onSubmit={handleSubmit} className="border border-divider p-5 space-y-4 bg-purple-50">
|
<form onSubmit={handleSubmit} className="border border-divider p-5 space-y-4 bg-accent-100">
|
||||||
<h3 className="text-sm font-semibold text-gray-800">HSE Verification</h3>
|
<h3 className="text-sm font-semibold text-gray-800">HSE Verification</h3>
|
||||||
<div className="flex gap-3">
|
<div className="flex gap-3">
|
||||||
<button
|
<button
|
||||||
@@ -47,8 +47,8 @@ export function VerifyForm({ capaId }: Props) {
|
|||||||
onClick={() => setVerdict('verified')}
|
onClick={() => setVerdict('verified')}
|
||||||
className={`flex-1 py-2 text-sm font-medium border ${
|
className={`flex-1 py-2 text-sm font-medium border ${
|
||||||
verdict === 'verified'
|
verdict === 'verified'
|
||||||
? 'bg-green-600 text-white border-green-600'
|
? 'bg-accent text-white border-accent'
|
||||||
: 'bg-surface text-gray-700 border-divider hover:border-green-500'
|
: 'bg-surface text-gray-700 border-divider hover:border-accent'
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
Verified — Effective
|
Verified — Effective
|
||||||
@@ -58,8 +58,8 @@ export function VerifyForm({ capaId }: Props) {
|
|||||||
onClick={() => setVerdict('reopened')}
|
onClick={() => setVerdict('reopened')}
|
||||||
className={`flex-1 py-2 text-sm font-medium border ${
|
className={`flex-1 py-2 text-sm font-medium border ${
|
||||||
verdict === 'reopened'
|
verdict === 'reopened'
|
||||||
? 'bg-orange-600 text-white border-orange-600'
|
? 'bg-accent text-white border-accent'
|
||||||
: 'bg-surface text-gray-700 border-divider hover:border-orange-500'
|
: 'bg-surface text-gray-700 border-divider hover:border-accent'
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
Reopen — Ineffective
|
Reopen — Ineffective
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ function TabsInner({ activeTab }: { activeTab: string }) {
|
|||||||
onClick={() => router.replace(`${pathname}?tab=${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 ${
|
className={`px-4 py-2.5 text-sm font-medium whitespace-nowrap border-b-2 transition-colors ${
|
||||||
activeTab === tab.key
|
activeTab === tab.key
|
||||||
? 'border-blue-600 text-blue-600'
|
? 'border-accent text-accent-700'
|
||||||
: 'border-transparent text-gray-500 hover:text-gray-700 hover:border-divider'
|
: 'border-transparent text-gray-500 hover:text-gray-700 hover:border-divider'
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ export function RiskFlagsPanel() {
|
|||||||
<button
|
<button
|
||||||
onClick={analyze}
|
onClick={analyze}
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
className="bg-purple-50 text-purple-700 border border-purple-300 px-3 py-1.5 text-xs font-semibold disabled:opacity-50 hover:bg-purple-100"
|
className="bg-accent-100 text-accent-700 border border-accent-300 px-3 py-1.5 text-xs font-semibold disabled:opacity-50 hover:bg-accent-200"
|
||||||
>
|
>
|
||||||
{loading ? 'Analyzing…' : flags ? 'Re-analyze' : 'Analyze 90-Day Risk'}
|
{loading ? 'Analyzing…' : flags ? 'Re-analyze' : 'Analyze 90-Day Risk'}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ interface Props {
|
|||||||
|
|
||||||
const ACCENT = {
|
const ACCENT = {
|
||||||
default: 'border-gray-200',
|
default: 'border-gray-200',
|
||||||
green: 'border-green-400',
|
green: 'border-divider',
|
||||||
yellow: 'border-yellow-400',
|
yellow: 'border-accent-300',
|
||||||
red: 'border-red-400',
|
red: 'border-red-400',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ export function ClosurePanel({ incidentId, status, canClose, canAddAddenda }: Pr
|
|||||||
<button
|
<button
|
||||||
onClick={closeIncident}
|
onClick={closeIncident}
|
||||||
disabled={busy}
|
disabled={busy}
|
||||||
className="bg-green-700 text-white px-4 py-2 text-sm font-semibold hover:bg-green-800 disabled:opacity-50"
|
className="bg-accent text-white px-4 py-2 text-sm font-semibold hover:bg-accent-700 disabled:opacity-50"
|
||||||
>
|
>
|
||||||
{busy ? 'Closing…' : 'Close Incident'}
|
{busy ? 'Closing…' : 'Close Incident'}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ export function FileUpload({ onFilesChange, disabled = false }: Props) {
|
|||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<div
|
<div
|
||||||
className={`border-2 border-dashed p-6 text-center cursor-pointer transition-colors
|
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'}
|
${dragging ? 'border-accent bg-accent-100' : 'border-divider hover:border-gray-400'}
|
||||||
${disabled ? 'opacity-50 pointer-events-none' : ''}`}
|
${disabled ? 'opacity-50 pointer-events-none' : ''}`}
|
||||||
onClick={() => inputRef.current?.click()}
|
onClick={() => inputRef.current?.click()}
|
||||||
onDragOver={e => { e.preventDefault(); setDragging(true) }}
|
onDragOver={e => { e.preventDefault(); setDragging(true) }}
|
||||||
|
|||||||
@@ -77,20 +77,20 @@ function FiltersInner({ sites, trucks }: FiltersProps) {
|
|||||||
placeholder="Search reference or description..."
|
placeholder="Search reference or description..."
|
||||||
value={search}
|
value={search}
|
||||||
onChange={e => handleSearch(e.target.value)}
|
onChange={e => handleSearch(e.target.value)}
|
||||||
className="w-full pl-8 pr-3 py-1.5 text-sm border border-divider focus:outline-none focus:ring-2 focus:ring-blue-500"
|
className="w-full pl-8 pr-3 py-1.5 text-sm border border-divider focus:outline-none focus:ring-2 focus:ring-accent"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<select
|
<select
|
||||||
value={searchParams.get('status') ?? ''}
|
value={searchParams.get('status') ?? ''}
|
||||||
onChange={e => updateParam('status', e.target.value)}
|
onChange={e => updateParam('status', e.target.value)}
|
||||||
className="text-sm border border-divider px-2 py-1.5 focus:outline-none focus:ring-2 focus:ring-blue-500 bg-surface"
|
className="text-sm border border-divider px-2 py-1.5 focus:outline-none focus:ring-2 focus:ring-accent bg-surface"
|
||||||
>
|
>
|
||||||
{STATUS_OPTIONS.map(o => <option key={o.value} value={o.value}>{o.label}</option>)}
|
{STATUS_OPTIONS.map(o => <option key={o.value} value={o.value}>{o.label}</option>)}
|
||||||
</select>
|
</select>
|
||||||
<select
|
<select
|
||||||
value={searchParams.get('type') ?? ''}
|
value={searchParams.get('type') ?? ''}
|
||||||
onChange={e => updateParam('type', e.target.value)}
|
onChange={e => updateParam('type', e.target.value)}
|
||||||
className="text-sm border border-divider px-2 py-1.5 focus:outline-none focus:ring-2 focus:ring-blue-500 bg-surface"
|
className="text-sm border border-divider px-2 py-1.5 focus:outline-none focus:ring-2 focus:ring-accent bg-surface"
|
||||||
>
|
>
|
||||||
{TYPE_OPTIONS.map(o => <option key={o.value} value={o.value}>{o.label}</option>)}
|
{TYPE_OPTIONS.map(o => <option key={o.value} value={o.value}>{o.label}</option>)}
|
||||||
</select>
|
</select>
|
||||||
@@ -98,7 +98,7 @@ function FiltersInner({ sites, trucks }: FiltersProps) {
|
|||||||
<select
|
<select
|
||||||
value={searchParams.get('site_id') ?? ''}
|
value={searchParams.get('site_id') ?? ''}
|
||||||
onChange={e => updateParam('site_id', e.target.value)}
|
onChange={e => updateParam('site_id', e.target.value)}
|
||||||
className="text-sm border border-divider px-2 py-1.5 focus:outline-none focus:ring-2 focus:ring-blue-500 bg-surface"
|
className="text-sm border border-divider px-2 py-1.5 focus:outline-none focus:ring-2 focus:ring-accent bg-surface"
|
||||||
>
|
>
|
||||||
<option value="">All Sites</option>
|
<option value="">All Sites</option>
|
||||||
{sites.map(s => <option key={s.id} value={s.id}>{s.name}</option>)}
|
{sites.map(s => <option key={s.id} value={s.id}>{s.name}</option>)}
|
||||||
@@ -108,7 +108,7 @@ function FiltersInner({ sites, trucks }: FiltersProps) {
|
|||||||
<select
|
<select
|
||||||
value={searchParams.get('truck_id') ?? ''}
|
value={searchParams.get('truck_id') ?? ''}
|
||||||
onChange={e => updateParam('truck_id', e.target.value)}
|
onChange={e => updateParam('truck_id', e.target.value)}
|
||||||
className="text-sm border border-divider px-2 py-1.5 focus:outline-none focus:ring-2 focus:ring-blue-500 bg-surface"
|
className="text-sm border border-divider px-2 py-1.5 focus:outline-none focus:ring-2 focus:ring-accent bg-surface"
|
||||||
>
|
>
|
||||||
<option value="">All Trucks</option>
|
<option value="">All Trucks</option>
|
||||||
{trucks.map(tk => <option key={tk.id} value={tk.id}>{tk.truck_no}</option>)}
|
{trucks.map(tk => <option key={tk.id} value={tk.id}>{tk.truck_no}</option>)}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export function IncidentHeader({
|
|||||||
{canTriage && (
|
{canTriage && (
|
||||||
<Link
|
<Link
|
||||||
href={`/hse/incidents/${incidentId}/triage`}
|
href={`/hse/incidents/${incidentId}/triage`}
|
||||||
className="text-xs px-3 py-1.5 bg-blue-600 text-white font-medium hover:bg-blue-700"
|
className="text-xs px-3 py-1.5 bg-accent text-white font-medium hover:bg-accent-600"
|
||||||
>
|
>
|
||||||
Triage
|
Triage
|
||||||
</Link>
|
</Link>
|
||||||
@@ -51,7 +51,7 @@ export function IncidentHeader({
|
|||||||
{canInvestigate && (
|
{canInvestigate && (
|
||||||
<Link
|
<Link
|
||||||
href={`/hse/incidents/${incidentId}/investigation`}
|
href={`/hse/incidents/${incidentId}/investigation`}
|
||||||
className="text-xs px-3 py-1.5 bg-indigo-600 text-white font-medium hover:bg-indigo-700"
|
className="text-xs px-3 py-1.5 bg-accent text-white font-medium hover:bg-accent-600"
|
||||||
>
|
>
|
||||||
Investigate
|
Investigate
|
||||||
</Link>
|
</Link>
|
||||||
@@ -59,7 +59,7 @@ export function IncidentHeader({
|
|||||||
{canAddCapa && (
|
{canAddCapa && (
|
||||||
<Link
|
<Link
|
||||||
href={`/hse/incidents/${incidentId}/capa/new`}
|
href={`/hse/incidents/${incidentId}/capa/new`}
|
||||||
className="text-xs px-3 py-1.5 bg-amber-600 text-white font-medium hover:bg-amber-700"
|
className="text-xs px-3 py-1.5 bg-accent text-white font-medium hover:bg-accent-600"
|
||||||
>
|
>
|
||||||
Add CAPA
|
Add CAPA
|
||||||
</Link>
|
</Link>
|
||||||
|
|||||||
@@ -60,12 +60,12 @@ export function IncidentList({ incidents, basePath }: Props) {
|
|||||||
<input
|
<input
|
||||||
type="search"
|
type="search"
|
||||||
placeholder="Search ref, type, site…"
|
placeholder="Search ref, type, site…"
|
||||||
className="border border-divider px-3 py-2 text-sm w-48 focus:outline-none focus:ring-2 focus:ring-blue-500"
|
className="border border-divider px-3 py-2 text-sm w-48 focus:outline-none focus:ring-2 focus:ring-accent"
|
||||||
value={search}
|
value={search}
|
||||||
onChange={e => setSearch(e.target.value)}
|
onChange={e => setSearch(e.target.value)}
|
||||||
/>
|
/>
|
||||||
<select
|
<select
|
||||||
className="border border-divider px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"
|
className="border border-divider px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-accent"
|
||||||
value={typeFilter}
|
value={typeFilter}
|
||||||
onChange={e => setTypeFilter(e.target.value)}
|
onChange={e => setTypeFilter(e.target.value)}
|
||||||
>
|
>
|
||||||
@@ -75,7 +75,7 @@ export function IncidentList({ incidents, basePath }: Props) {
|
|||||||
))}
|
))}
|
||||||
</select>
|
</select>
|
||||||
<select
|
<select
|
||||||
className="border border-divider px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"
|
className="border border-divider px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-accent"
|
||||||
value={statusFilter}
|
value={statusFilter}
|
||||||
onChange={e => setStatusFilter(e.target.value)}
|
onChange={e => setStatusFilter(e.target.value)}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ export function InvestigationForm({ incidentId, existingInvestigationId }: Props
|
|||||||
type="button"
|
type="button"
|
||||||
onClick={getAiDraft}
|
onClick={getAiDraft}
|
||||||
disabled={aiDraftLoading}
|
disabled={aiDraftLoading}
|
||||||
className="bg-purple-50 text-purple-700 border border-purple-300 px-3 py-1.5 text-xs font-semibold disabled:opacity-50 hover:bg-purple-100"
|
className="bg-accent-100 text-accent-700 border border-accent-300 px-3 py-1.5 text-xs font-semibold disabled:opacity-50 hover:bg-accent-200"
|
||||||
>
|
>
|
||||||
{aiDraftLoading ? 'Drafting…' : 'Get AI Draft'}
|
{aiDraftLoading ? 'Drafting…' : 'Get AI Draft'}
|
||||||
</button>
|
</button>
|
||||||
@@ -150,8 +150,8 @@ export function InvestigationForm({ incidentId, existingInvestigationId }: Props
|
|||||||
onClick={() => setMethod(m)}
|
onClick={() => setMethod(m)}
|
||||||
className={`px-3 py-1.5 text-sm font-medium border ${
|
className={`px-3 py-1.5 text-sm font-medium border ${
|
||||||
method === m
|
method === m
|
||||||
? 'bg-blue-600 text-white border-blue-600'
|
? 'bg-accent text-white border-accent'
|
||||||
: 'bg-surface text-gray-700 border-divider hover:border-blue-400'
|
: 'bg-surface text-gray-700 border-divider hover:border-accent'
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
{m === 'five_why' ? '5-Why' : m === 'fishbone' ? 'Fishbone' : 'Other'}
|
{m === 'five_why' ? '5-Why' : m === 'fishbone' ? 'Fishbone' : 'Other'}
|
||||||
@@ -182,7 +182,7 @@ export function InvestigationForm({ incidentId, existingInvestigationId }: Props
|
|||||||
))}
|
))}
|
||||||
{fiveWhy.length < 5 && (
|
{fiveWhy.length < 5 && (
|
||||||
<button type="button" onClick={addWhyStep}
|
<button type="button" onClick={addWhyStep}
|
||||||
className="text-sm text-blue-600 hover:underline">
|
className="text-sm text-accent-700 hover:underline">
|
||||||
+ Add another Why
|
+ Add another Why
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
@@ -205,7 +205,7 @@ export function InvestigationForm({ incidentId, existingInvestigationId }: Props
|
|||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
<button type="button" onClick={() => addFishboneCause(catIdx)}
|
<button type="button" onClick={() => addFishboneCause(catIdx)}
|
||||||
className="text-xs text-blue-600 hover:underline">
|
className="text-xs text-accent-700 hover:underline">
|
||||||
+ Add cause
|
+ Add cause
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -262,7 +262,7 @@ export function InvestigationForm({ incidentId, existingInvestigationId }: Props
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => setWitnessRefs([...witnessRefs, ''])}
|
onClick={() => setWitnessRefs([...witnessRefs, ''])}
|
||||||
className="text-xs text-blue-600 hover:underline"
|
className="text-xs text-accent-700 hover:underline"
|
||||||
>
|
>
|
||||||
+ Add witness statement
|
+ Add witness statement
|
||||||
</button>
|
</button>
|
||||||
@@ -293,7 +293,7 @@ export function InvestigationForm({ incidentId, existingInvestigationId }: Props
|
|||||||
{!existingInvestigationId && (
|
{!existingInvestigationId && (
|
||||||
<label className="flex items-center gap-2 text-sm text-gray-700">
|
<label className="flex items-center gap-2 text-sm text-gray-700">
|
||||||
<input type="checkbox" checked={complete} onChange={e => setComplete(e.target.checked)}
|
<input type="checkbox" checked={complete} onChange={e => setComplete(e.target.checked)}
|
||||||
className="border-divider text-blue-600" />
|
className="border-divider text-accent-700" />
|
||||||
Mark investigation complete (transitions incident to CAPA Pending)
|
Mark investigation complete (transitions incident to CAPA Pending)
|
||||||
</label>
|
</label>
|
||||||
)}
|
)}
|
||||||
@@ -301,7 +301,7 @@ export function InvestigationForm({ incidentId, existingInvestigationId }: Props
|
|||||||
{error && <p className="text-sm text-red-600">{error}</p>}
|
{error && <p className="text-sm text-red-600">{error}</p>}
|
||||||
|
|
||||||
<button type="submit" disabled={saving}
|
<button type="submit" disabled={saving}
|
||||||
className="w-full bg-indigo-600 text-white py-2 text-sm font-semibold disabled:opacity-50">
|
className="w-full bg-accent text-white py-2 text-sm font-semibold disabled:opacity-50">
|
||||||
{saving ? 'Saving…' : existingInvestigationId ? 'Update Investigation' : 'Start Investigation'}
|
{saving ? 'Saving…' : existingInvestigationId ? 'Update Investigation' : 'Start Investigation'}
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -40,10 +40,10 @@ export function InvestigationPanel({ investigation: inv }: Props) {
|
|||||||
<h2 className="text-sm font-semibold text-gray-900">Investigation</h2>
|
<h2 className="text-sm font-semibold text-gray-900">Investigation</h2>
|
||||||
<div className="flex items-center gap-2">
|
<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 text-gray-500">{METHOD_LABELS[inv.method] ?? inv.method}</span>
|
||||||
<span className={`text-xs font-medium px-2 py-0.5 rounded-full ${
|
<span className={`text-xs font-medium px-2 py-0.5 ${
|
||||||
inv.completed_at
|
inv.completed_at
|
||||||
? 'bg-green-100 text-green-700'
|
? 'bg-neutral-100 text-ink'
|
||||||
: 'bg-yellow-100 text-yellow-700'
|
: 'bg-accent-100 text-accent-700'
|
||||||
}`}>
|
}`}>
|
||||||
{inv.completed_at ? 'Completed' : 'In Progress'}
|
{inv.completed_at ? 'Completed' : 'In Progress'}
|
||||||
</span>
|
</span>
|
||||||
@@ -67,7 +67,7 @@ export function InvestigationPanel({ investigation: inv }: Props) {
|
|||||||
<ol className="space-y-3">
|
<ol className="space-y-3">
|
||||||
{inv.five_why_steps.map((step, i) => (
|
{inv.five_why_steps.map((step, i) => (
|
||||||
<li key={i} className="flex gap-3">
|
<li key={i} className="flex gap-3">
|
||||||
<span className="flex-shrink-0 w-6 h-6 rounded-full bg-blue-100 text-blue-700 text-xs font-bold flex items-center justify-center">
|
<span className="flex-shrink-0 w-6 h-6 bg-accent-100 text-accent-700 text-xs font-bold flex items-center justify-center">
|
||||||
{i + 1}
|
{i + 1}
|
||||||
</span>
|
</span>
|
||||||
<div className="flex-1 min-w-0">
|
<div className="flex-1 min-w-0">
|
||||||
|
|||||||
@@ -56,15 +56,15 @@ export function OfflineSync() {
|
|||||||
if (pendingCount === 0) return null
|
if (pendingCount === 0) return null
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="fixed bottom-4 left-4 right-4 bg-yellow-50 border border-yellow-300 p-3 flex items-center justify-between shadow-md z-50">
|
<div className="fixed bottom-4 left-4 right-4 bg-accent-100 border border-accent-300 p-3 flex items-center justify-between shadow-md z-50">
|
||||||
<span className="text-sm text-yellow-800 font-medium">
|
<span className="text-sm text-accent-700 font-medium">
|
||||||
{pendingCount} report{pendingCount > 1 ? 's' : ''} saved offline
|
{pendingCount} report{pendingCount > 1 ? 's' : ''} saved offline
|
||||||
</span>
|
</span>
|
||||||
<button
|
<button
|
||||||
onClick={syncNow}
|
onClick={syncNow}
|
||||||
disabled={syncing || !navigator.onLine}
|
disabled={syncing || !navigator.onLine}
|
||||||
className="text-xs bg-yellow-600 text-white px-3 py-1.5 font-medium
|
className="text-xs bg-accent text-white px-3 py-1.5 font-medium
|
||||||
hover:bg-yellow-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors"
|
hover:bg-accent-600 disabled:opacity-50 disabled:cursor-not-allowed transition-colors"
|
||||||
>
|
>
|
||||||
{syncing ? 'Syncing…' : 'Sync now'}
|
{syncing ? 'Syncing…' : 'Sync now'}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export function Pagination({ page, pageSize, total, href }: Props) {
|
|||||||
disabled ? (
|
disabled ? (
|
||||||
<span className="px-3 py-1.5 text-sm text-gray-300">{label}</span>
|
<span className="px-3 py-1.5 text-sm text-gray-300">{label}</span>
|
||||||
) : (
|
) : (
|
||||||
<Link href={`${href}?page=${p}`} className="px-3 py-1.5 text-sm text-blue-600 hover:underline">
|
<Link href={`${href}?page=${p}`} className="px-3 py-1.5 text-sm text-accent-700 hover:underline">
|
||||||
{label}
|
{label}
|
||||||
</Link>
|
</Link>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ export function ReportForm({ zoneToken, trucks, initialTruckId }: Props) {
|
|||||||
value={(typeDetails[key] as string) ?? ''}
|
value={(typeDetails[key] as string) ?? ''}
|
||||||
onChange={e => setDetail(key, e.target.value)}
|
onChange={e => setDetail(key, e.target.value)}
|
||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
className="w-full border border-divider px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"
|
className="w-full border border-divider px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-accent"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
@@ -82,7 +82,7 @@ export function ReportForm({ zoneToken, trucks, initialTruckId }: Props) {
|
|||||||
<label className="flex items-center gap-3 cursor-pointer">
|
<label className="flex items-center gap-3 cursor-pointer">
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
className="w-4 h-4 text-blue-600"
|
className="w-4 h-4 text-accent-700"
|
||||||
checked={Boolean(typeDetails[key])}
|
checked={Boolean(typeDetails[key])}
|
||||||
onChange={e => setDetail(key, e.target.checked)}
|
onChange={e => setDetail(key, e.target.checked)}
|
||||||
/>
|
/>
|
||||||
@@ -205,7 +205,7 @@ export function ReportForm({ zoneToken, trucks, initialTruckId }: Props) {
|
|||||||
|
|
||||||
if (savedOffline) {
|
if (savedOffline) {
|
||||||
return (
|
return (
|
||||||
<div className="bg-green-50 border border-green-200 p-5 text-sm text-green-700">
|
<div className="bg-neutral-100 border border-divider p-5 text-sm text-ink">
|
||||||
{t.savedOffline}
|
{t.savedOffline}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
@@ -214,7 +214,7 @@ export function ReportForm({ zoneToken, trucks, initialTruckId }: Props) {
|
|||||||
return (
|
return (
|
||||||
<form onSubmit={handleSubmit} className="space-y-5 bg-surface shadow-sm p-5">
|
<form onSubmit={handleSubmit} className="space-y-5 bg-surface shadow-sm p-5">
|
||||||
{!isOnline && (
|
{!isOnline && (
|
||||||
<div className="bg-yellow-50 border border-yellow-200 p-3 text-sm text-yellow-700">
|
<div className="bg-accent-100 border border-accent-300 p-3 text-sm text-accent-700">
|
||||||
{t.offlineBanner}
|
{t.offlineBanner}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@@ -231,7 +231,7 @@ export function ReportForm({ zoneToken, trucks, initialTruckId }: Props) {
|
|||||||
</label>
|
</label>
|
||||||
<select
|
<select
|
||||||
required
|
required
|
||||||
className="w-full border border-divider px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"
|
className="w-full border border-divider px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-accent"
|
||||||
value={form.incident_type}
|
value={form.incident_type}
|
||||||
onChange={e => {
|
onChange={e => {
|
||||||
setForm(f => ({ ...f, incident_type: e.target.value as IncidentType, truck_id: '' }))
|
setForm(f => ({ ...f, incident_type: e.target.value as IncidentType, truck_id: '' }))
|
||||||
@@ -278,7 +278,7 @@ export function ReportForm({ zoneToken, trucks, initialTruckId }: Props) {
|
|||||||
</label>
|
</label>
|
||||||
<select
|
<select
|
||||||
required
|
required
|
||||||
className="w-full border border-divider px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"
|
className="w-full border border-divider px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-accent"
|
||||||
value={form.truck_id}
|
value={form.truck_id}
|
||||||
onChange={e => setForm(f => ({ ...f, truck_id: e.target.value }))}
|
onChange={e => setForm(f => ({ ...f, truck_id: e.target.value }))}
|
||||||
>
|
>
|
||||||
@@ -301,31 +301,31 @@ export function ReportForm({ zoneToken, trucks, initialTruckId }: Props) {
|
|||||||
minLength={10}
|
minLength={10}
|
||||||
rows={4}
|
rows={4}
|
||||||
placeholder={t.descriptionPlaceholder}
|
placeholder={t.descriptionPlaceholder}
|
||||||
className="w-full border border-divider px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 resize-none"
|
className="w-full border border-divider px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-accent resize-none"
|
||||||
value={form.description}
|
value={form.description}
|
||||||
onChange={e => setForm(f => ({ ...f, description: e.target.value }))}
|
onChange={e => setForm(f => ({ ...f, description: e.target.value }))}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{qualityCheck && !qualityCheck.passes && (
|
{qualityCheck && !qualityCheck.passes && (
|
||||||
<div className="bg-amber-50 border border-amber-200 p-3 space-y-2">
|
<div className="bg-accent-100 border border-accent-300 p-3 space-y-2">
|
||||||
<p className="text-xs font-semibold text-amber-700 uppercase tracking-wide">
|
<p className="text-xs font-semibold text-accent-700 uppercase tracking-wide">
|
||||||
{t.qualityScoreLabel.replace('{score}', String(qualityCheck.score))}
|
{t.qualityScoreLabel.replace('{score}', String(qualityCheck.score))}
|
||||||
</p>
|
</p>
|
||||||
<p className="text-sm text-amber-800">{qualityCheck.feedback}</p>
|
<p className="text-sm text-accent-700">{qualityCheck.feedback}</p>
|
||||||
{qualityCheck.suggestions.length > 0 && (
|
{qualityCheck.suggestions.length > 0 && (
|
||||||
<ul className="list-disc list-inside space-y-1">
|
<ul className="list-disc list-inside space-y-1">
|
||||||
{qualityCheck.suggestions.map((s, i) => (
|
{qualityCheck.suggestions.map((s, i) => (
|
||||||
<li key={i} className="text-xs text-amber-700">{s}</li>
|
<li key={i} className="text-xs text-accent-700">{s}</li>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
)}
|
)}
|
||||||
<label className="flex items-center gap-2 text-xs text-amber-700 cursor-pointer mt-1">
|
<label className="flex items-center gap-2 text-xs text-accent-700 cursor-pointer mt-1">
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
checked={overrideQuality}
|
checked={overrideQuality}
|
||||||
onChange={e => setOverrideQuality(e.target.checked)}
|
onChange={e => setOverrideQuality(e.target.checked)}
|
||||||
className="border-amber-300 text-amber-600"
|
className="border-accent-300 text-accent-700"
|
||||||
/>
|
/>
|
||||||
{t.submitAnyway}
|
{t.submitAnyway}
|
||||||
</label>
|
</label>
|
||||||
@@ -336,7 +336,7 @@ export function ReportForm({ zoneToken, trucks, initialTruckId }: Props) {
|
|||||||
<label className="flex items-center gap-3 cursor-pointer">
|
<label className="flex items-center gap-3 cursor-pointer">
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
className="w-4 h-4 text-blue-600"
|
className="w-4 h-4 text-accent-700"
|
||||||
checked={form.injury_involved}
|
checked={form.injury_involved}
|
||||||
onChange={e => setForm(f => ({ ...f, injury_involved: e.target.checked, medical_status: '' }))}
|
onChange={e => setForm(f => ({ ...f, injury_involved: e.target.checked, medical_status: '' }))}
|
||||||
/>
|
/>
|
||||||
@@ -350,7 +350,7 @@ export function ReportForm({ zoneToken, trucks, initialTruckId }: Props) {
|
|||||||
</label>
|
</label>
|
||||||
<select
|
<select
|
||||||
required={form.injury_involved}
|
required={form.injury_involved}
|
||||||
className="w-full border border-divider px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"
|
className="w-full border border-divider px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-accent"
|
||||||
value={form.medical_status}
|
value={form.medical_status}
|
||||||
onChange={e => setForm(f => ({ ...f, medical_status: e.target.value as MedicalStatus }))}
|
onChange={e => setForm(f => ({ ...f, medical_status: e.target.value as MedicalStatus }))}
|
||||||
>
|
>
|
||||||
@@ -365,7 +365,7 @@ export function ReportForm({ zoneToken, trucks, initialTruckId }: Props) {
|
|||||||
<label className="flex items-center gap-3 cursor-pointer">
|
<label className="flex items-center gap-3 cursor-pointer">
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
className="w-4 h-4 text-blue-600"
|
className="w-4 h-4 text-accent-700"
|
||||||
checked={form.asset_involved}
|
checked={form.asset_involved}
|
||||||
onChange={e => setForm(f => ({ ...f, asset_involved: e.target.checked }))}
|
onChange={e => setForm(f => ({ ...f, asset_involved: e.target.checked }))}
|
||||||
/>
|
/>
|
||||||
@@ -383,8 +383,8 @@ export function ReportForm({ zoneToken, trucks, initialTruckId }: Props) {
|
|||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={submitting || !form.incident_type || (form.incident_type === 'transport' && !form.truck_id)}
|
disabled={submitting || !form.incident_type || (form.incident_type === 'transport' && !form.truck_id)}
|
||||||
className="w-full bg-blue-600 text-white py-3 font-medium text-sm
|
className="w-full bg-accent text-white py-3 font-medium text-sm
|
||||||
hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors"
|
hover:bg-accent-600 disabled:opacity-50 disabled:cursor-not-allowed transition-colors"
|
||||||
>
|
>
|
||||||
{submitting ? t.submitting : t.submitButton}
|
{submitting ? t.submitting : t.submitButton}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ export function SimilarIncidentsPanel({ incidentId }: Props) {
|
|||||||
<a
|
<a
|
||||||
key={inc.id}
|
key={inc.id}
|
||||||
href={`/hse/incidents/${inc.id}`}
|
href={`/hse/incidents/${inc.id}`}
|
||||||
className="block border border-divider p-3 hover:border-blue-300 hover:bg-blue-50 transition-colors"
|
className="block border border-divider p-3 hover:border-accent hover:bg-neutral-100 transition-colors"
|
||||||
>
|
>
|
||||||
<div className="flex items-center justify-between mb-1">
|
<div className="flex items-center justify-between mb-1">
|
||||||
<span className="text-xs font-medium text-gray-500">
|
<span className="text-xs font-medium text-gray-500">
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ export function TriageForm({ incidentId, currentSeverity }: Props) {
|
|||||||
onClick={() => setSeverity(v)}
|
onClick={() => setSeverity(v)}
|
||||||
className={`flex-1 py-2 text-xs font-medium transition-colors ${
|
className={`flex-1 py-2 text-xs font-medium transition-colors ${
|
||||||
severity === v
|
severity === v
|
||||||
? 'bg-blue-600 text-white border-blue-600'
|
? 'bg-accent text-white border-accent'
|
||||||
: 'bg-surface text-gray-700 hover:bg-gray-50'
|
: 'bg-surface text-gray-700 hover:bg-gray-50'
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
@@ -126,7 +126,7 @@ export function TriageForm({ incidentId, currentSeverity }: Props) {
|
|||||||
<input
|
<input
|
||||||
type="checkbox" checked={value}
|
type="checkbox" checked={value}
|
||||||
onChange={e => set(e.target.checked)}
|
onChange={e => set(e.target.checked)}
|
||||||
className="border-divider text-blue-600"
|
className="border-divider text-accent-700"
|
||||||
/>
|
/>
|
||||||
{label}
|
{label}
|
||||||
</label>
|
</label>
|
||||||
@@ -151,16 +151,16 @@ export function TriageForm({ incidentId, currentSeverity }: Props) {
|
|||||||
value={triageNotes}
|
value={triageNotes}
|
||||||
onChange={e => setTriageNotes(e.target.value)}
|
onChange={e => setTriageNotes(e.target.value)}
|
||||||
rows={3}
|
rows={3}
|
||||||
className="w-full border border-divider px-3 py-2 text-sm focus:ring-2 focus:ring-blue-500 focus:border-transparent"
|
className="w-full border border-divider px-3 py-2 text-sm focus:ring-2 focus:ring-accent focus:border-transparent"
|
||||||
placeholder="Initial assessment, immediate actions taken..."
|
placeholder="Initial assessment, immediate actions taken..."
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{aiRationale && (
|
{aiRationale && (
|
||||||
<div className="bg-purple-50 border border-purple-200 p-3">
|
<div className="bg-accent-100 border border-accent-300 p-3">
|
||||||
<p className="text-xs font-semibold text-purple-700 mb-1">AI Suggestion Rationale</p>
|
<p className="text-xs font-semibold text-accent-700 mb-1">AI Suggestion Rationale</p>
|
||||||
<p className="text-xs text-purple-600">{aiRationale}</p>
|
<p className="text-xs text-accent-700">{aiRationale}</p>
|
||||||
<p className="text-xs text-purple-400 mt-1">Fields pre-filled — review before submitting.</p>
|
<p className="text-xs text-accent-400 mt-1">Fields pre-filled — review before submitting.</p>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
@@ -171,14 +171,14 @@ export function TriageForm({ incidentId, currentSeverity }: Props) {
|
|||||||
type="button"
|
type="button"
|
||||||
onClick={getAiSuggestion}
|
onClick={getAiSuggestion}
|
||||||
disabled={aiLoading || saving}
|
disabled={aiLoading || saving}
|
||||||
className="flex-1 bg-purple-50 text-purple-700 border border-purple-300 py-2 text-sm font-semibold disabled:opacity-50 hover:bg-purple-100"
|
className="flex-1 bg-accent-100 text-accent-700 border border-accent-300 py-2 text-sm font-semibold disabled:opacity-50 hover:bg-accent-200"
|
||||||
>
|
>
|
||||||
{aiLoading ? 'Getting suggestion…' : 'Get AI Suggestion'}
|
{aiLoading ? 'Getting suggestion…' : 'Get AI Suggestion'}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={saving}
|
disabled={saving}
|
||||||
className="flex-1 bg-blue-600 text-white py-2 text-sm font-semibold disabled:opacity-50"
|
className="flex-1 bg-accent text-white py-2 text-sm font-semibold disabled:opacity-50"
|
||||||
>
|
>
|
||||||
{saving ? 'Saving…' : 'Complete Triage'}
|
{saving ? 'Saving…' : 'Complete Triage'}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ export function LanguageSwitcher() {
|
|||||||
value={current}
|
value={current}
|
||||||
onChange={e => handleChange(e.target.value)}
|
onChange={e => handleChange(e.target.value)}
|
||||||
aria-label="Select language"
|
aria-label="Select language"
|
||||||
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"
|
className="text-xs border border-divider px-2 py-1 bg-surface text-gray-700 focus:outline-none focus:ring-1 focus:ring-accent"
|
||||||
>
|
>
|
||||||
{Object.entries(LOCALES).map(([code, label]) => (
|
{Object.entries(LOCALES).map(([code, label]) => (
|
||||||
<option key={code} value={code}>{label}</option>
|
<option key={code} value={code}>{label}</option>
|
||||||
|
|||||||
@@ -47,10 +47,10 @@ export function ApiKeyForm({ settings }: Props) {
|
|||||||
<div key={key} className="bg-surface shadow-sm p-5">
|
<div key={key} className="bg-surface shadow-sm p-5">
|
||||||
<div className="flex items-center justify-between mb-1">
|
<div className="flex items-center justify-between mb-1">
|
||||||
<label className="text-sm font-semibold text-gray-800">{KEY_LABELS[key]}</label>
|
<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 ${
|
<span className={`text-xs font-medium px-2 py-0.5 ${
|
||||||
status?.set
|
status?.set
|
||||||
? 'bg-green-100 text-green-700'
|
? 'bg-neutral-100 text-ink'
|
||||||
: 'bg-yellow-100 text-yellow-700'
|
: 'bg-accent-100 text-accent-700'
|
||||||
}`}>
|
}`}>
|
||||||
{status?.set ? 'Configured' : 'Not set'}
|
{status?.set ? 'Configured' : 'Not set'}
|
||||||
</span>
|
</span>
|
||||||
@@ -66,18 +66,18 @@ export function ApiKeyForm({ settings }: Props) {
|
|||||||
value={values[key]}
|
value={values[key]}
|
||||||
onChange={e => setValues(v => ({ ...v, [key]: e.target.value }))}
|
onChange={e => setValues(v => ({ ...v, [key]: e.target.value }))}
|
||||||
placeholder={status?.set ? 'Enter new key to replace…' : 'Enter API key…'}
|
placeholder={status?.set ? 'Enter new key to replace…' : 'Enter API key…'}
|
||||||
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"
|
className="flex-1 border border-divider px-3 py-2 text-sm text-gray-900 placeholder-gray-500 focus:ring-2 focus:ring-accent focus:border-transparent font-mono"
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
onClick={() => save(key)}
|
onClick={() => save(key)}
|
||||||
disabled={saving[key] || !values[key]}
|
disabled={saving[key] || !values[key]}
|
||||||
className="bg-blue-600 text-white px-4 py-2 text-sm font-semibold disabled:opacity-50 hover:bg-blue-700"
|
className="bg-accent text-white px-4 py-2 text-sm font-semibold disabled:opacity-50 hover:bg-accent-600"
|
||||||
>
|
>
|
||||||
{saving[key] ? 'Saving…' : 'Save'}
|
{saving[key] ? 'Saving…' : 'Save'}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
{results[key] === 'ok' && (
|
{results[key] === 'ok' && (
|
||||||
<p className="text-xs text-green-600 mt-2">Saved. Reload the page to confirm.</p>
|
<p className="text-xs text-ink mt-2">Saved. Reload the page to confirm.</p>
|
||||||
)}
|
)}
|
||||||
{results[key] === 'error' && (
|
{results[key] === 'error' && (
|
||||||
<p className="text-xs text-red-600 mt-2">Save failed. Check your permissions.</p>
|
<p className="text-xs text-red-600 mt-2">Save failed. Check your permissions.</p>
|
||||||
|
|||||||
@@ -451,7 +451,6 @@ function transformClassAttr(attr) {
|
|||||||
out = out.replace(/(?<![\w-])shadow-(?:xl|2xl)(?![\w-])/g, 'shadow-lg')
|
out = out.replace(/(?<![\w-])shadow-(?:xl|2xl)(?![\w-])/g, 'shadow-lg')
|
||||||
out = out.replace(/(["'])([^"'`$]*)\1/g, (_, q, body) => q + body.trim().replace(/ {2,}/g, ' ') + q)
|
out = out.replace(/(["'])([^"'`$]*)\1/g, (_, q, body) => q + body.trim().replace(/ {2,}/g, ' ') + q)
|
||||||
out = out.replace(/^(className=\{`)\s+/, '$1').replace(/\s+(`\})$/, '$1')
|
out = out.replace(/^(className=\{`)\s+/, '$1').replace(/\s+(`\})$/, '$1')
|
||||||
out = out.replace(/ {2,}/g, ' ')
|
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -9,7 +9,8 @@
|
|||||||
"lint": "eslint",
|
"lint": "eslint",
|
||||||
"test": "vitest run",
|
"test": "vitest run",
|
||||||
"test:watch": "vitest",
|
"test:watch": "vitest",
|
||||||
"generate-qr": "tsx scripts/generate-qr.ts"
|
"generate-qr": "tsx scripts/generate-qr.ts",
|
||||||
|
"check:design": "node scripts/check-design-gates.mjs"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@anthropic-ai/sdk": "^0.111.0",
|
"@anthropic-ai/sdk": "^0.111.0",
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
import { readdirSync, readFileSync, statSync } from 'node:fs'
|
||||||
|
import path from 'node:path'
|
||||||
|
import { fileURLToPath } from 'node:url'
|
||||||
|
|
||||||
|
// Files where a circular element is legitimate (avatar). Add others only with a reason.
|
||||||
|
export const ROUND_ALLOWED = ['components/layout/sidebar.tsx']
|
||||||
|
|
||||||
|
const RULES = [
|
||||||
|
{
|
||||||
|
rule: 'no-rounded',
|
||||||
|
re: /(?<=[\s"'`:{])(?:[\w-]+:)*rounded(?:-(?!full(?![\w-]))[\w]+)*(?=[\s"'`}])/,
|
||||||
|
},
|
||||||
|
{ rule: 'no-bg-white', re: /(?<![\w-])bg-white(?![\w-])/ },
|
||||||
|
{ rule: 'no-heavy-shadow', re: /(?<![\w-])shadow-(?:xl|2xl)(?![\w-])/ },
|
||||||
|
{
|
||||||
|
rule: 'off-palette',
|
||||||
|
re: /(?<![\w-])(?:bg|text|border|ring|from|to|via|divide|fill|stroke|outline)-(?:green|yellow|amber|orange|purple|indigo|teal|emerald|sky|cyan|pink|rose|violet|lime|fuchsia)-\d{2,3}/,
|
||||||
|
},
|
||||||
|
{ rule: 'no-hex', re: /(?<![&\w])#[0-9a-fA-F]{3,8}\b/ },
|
||||||
|
{ rule: 'no-centered-button', re: /<button[^>]*className=[^>]*(?<![\w-])text-center(?![\w-])/ },
|
||||||
|
]
|
||||||
|
|
||||||
|
export function findViolations(src, file) {
|
||||||
|
const out = []
|
||||||
|
const roundAllowed = ROUND_ALLOWED.includes(file)
|
||||||
|
src.split('\n').forEach((text, i) => {
|
||||||
|
const line = i + 1
|
||||||
|
for (const { rule, re } of RULES) {
|
||||||
|
if (re.test(text)) out.push({ file, line, rule, text: text.trim() })
|
||||||
|
}
|
||||||
|
if (!roundAllowed && /(?<=[\s"'`:{])(?:[\w-]+:)*rounded-full(?=[\s"'`}])/.test(text)) {
|
||||||
|
out.push({ file, line, rule: 'no-rounded-full', text: text.trim() })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
function walk(dir, files = []) {
|
||||||
|
for (const name of readdirSync(dir)) {
|
||||||
|
const full = path.join(dir, name)
|
||||||
|
if (statSync(full).isDirectory()) walk(full, files)
|
||||||
|
else if (full.endsWith('.tsx')) files.push(full)
|
||||||
|
}
|
||||||
|
return files
|
||||||
|
}
|
||||||
|
|
||||||
|
function main() {
|
||||||
|
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
|
||||||
|
const all = []
|
||||||
|
for (const dir of ['app', 'components']) {
|
||||||
|
for (const abs of walk(path.join(root, dir))) {
|
||||||
|
const rel = path.relative(root, abs).split(path.sep).join('/')
|
||||||
|
all.push(...findViolations(readFileSync(abs, 'utf8'), rel))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const v of all) console.log(`${v.file}:${v.line} [${v.rule}] ${v.text}`)
|
||||||
|
console.log(all.length === 0 ? 'design gates: clean' : `design gates: ${all.length} violation(s)`)
|
||||||
|
process.exit(all.length === 0 ? 0 : 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) main()
|
||||||
@@ -17,7 +17,6 @@ function transformClassAttr(attr) {
|
|||||||
out = out.replace(/(?<![\w-])shadow-(?:xl|2xl)(?![\w-])/g, 'shadow-lg')
|
out = out.replace(/(?<![\w-])shadow-(?:xl|2xl)(?![\w-])/g, 'shadow-lg')
|
||||||
out = out.replace(/(["'])([^"'`$]*)\1/g, (_, q, body) => q + body.trim().replace(/ {2,}/g, ' ') + q)
|
out = out.replace(/(["'])([^"'`$]*)\1/g, (_, q, body) => q + body.trim().replace(/ {2,}/g, ' ') + q)
|
||||||
out = out.replace(/^(className=\{`)\s+/, '$1').replace(/\s+(`\})$/, '$1')
|
out = out.replace(/^(className=\{`)\s+/, '$1').replace(/\s+(`\})$/, '$1')
|
||||||
out = out.replace(/ {2,}/g, ' ')
|
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,11 @@ describe('Modernist tokens in globals.css', () => {
|
|||||||
expect(css).toMatch(/--color-blue-700:\s*var\(--color-accent-700\)/)
|
expect(css).toMatch(/--color-blue-700:\s*var\(--color-accent-700\)/)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('remaps the red ramp onto the accent ramp, with body-size steps on accent-700', () => {
|
||||||
|
expect(css).toMatch(/--color-red-600:\s*var\(--color-accent-700\)/)
|
||||||
|
expect(css).toMatch(/--color-red-50:\s*var\(--color-accent-100\)/)
|
||||||
|
})
|
||||||
|
|
||||||
it('maps shadows onto the Modernist elevation tokens', () => {
|
it('maps shadows onto the Modernist elevation tokens', () => {
|
||||||
expect(css).toMatch(/--shadow-2xl:\s*var\(--shadow-lg\)/)
|
expect(css).toMatch(/--shadow-2xl:\s*var\(--shadow-lg\)/)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
import { describe, it, expect } from 'vitest'
|
||||||
|
import { findViolations, ROUND_ALLOWED } from '../../scripts/check-design-gates.mjs'
|
||||||
|
|
||||||
|
const rules = (src: string, file = 'components/x.tsx'): string[] =>
|
||||||
|
(findViolations(src, file) as Array<{ rule: string }>).map(v => v.rule)
|
||||||
|
|
||||||
|
describe('design gates', () => {
|
||||||
|
it('flags rounded corner classes', () => {
|
||||||
|
expect(rules('<div className="rounded-lg p-2" />')).toContain('no-rounded')
|
||||||
|
expect(rules('<div className="p-2 hover:rounded-md" />')).toContain('no-rounded')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('flags rounded-full outside the allowlist and accepts it inside', () => {
|
||||||
|
expect(rules('<div className="rounded-full" />')).toContain('no-rounded-full')
|
||||||
|
expect(rules('<div className="rounded-full" />', ROUND_ALLOWED[0])).not.toContain('no-rounded-full')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('flags off-palette colors but accepts remapped gray, blue and red', () => {
|
||||||
|
expect(rules('<p className="text-green-700" />')).toContain('off-palette')
|
||||||
|
expect(rules('<p className="bg-purple-100" />')).toContain('off-palette')
|
||||||
|
expect(rules('<p className="text-gray-500 text-blue-700 bg-red-50" />')).toEqual([])
|
||||||
|
})
|
||||||
|
|
||||||
|
it('flags hard-coded hex colors', () => {
|
||||||
|
expect(rules('<div style={{ color: "#ec3013" }} />')).toContain('no-hex')
|
||||||
|
expect(rules('<p>'quoted'</p>')).not.toContain('no-hex')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('flags centered button labels', () => {
|
||||||
|
expect(rules('<button className="text-center px-2">x</button>')).toContain('no-centered-button')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('flags leftovers the codemod should have replaced', () => {
|
||||||
|
expect(rules('<div className="bg-white shadow-2xl" />')).toEqual(expect.arrayContaining(['no-bg-white', 'no-heavy-shadow']))
|
||||||
|
})
|
||||||
|
|
||||||
|
it('reports file and 1-based line numbers', () => {
|
||||||
|
const v = findViolations('a\n<div className="rounded-md" />', 'components/y.tsx')
|
||||||
|
expect(v[0]).toMatchObject({ file: 'components/y.tsx', line: 2, rule: 'no-rounded' })
|
||||||
|
})
|
||||||
|
|
||||||
|
it('accepts clean on-system markup', () => {
|
||||||
|
expect(rules('<div className="bg-surface border border-divider p-4 text-ink shadow-sm" />')).toEqual([])
|
||||||
|
})
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user