refactor(design): drop rounded classes, swap bg-white and gray borders for tokens
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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>
|
||||
</div>
|
||||
<div className="mb-6 flex gap-3">
|
||||
<Link href="/bulk-import" className="px-4 py-2 bg-green-600 text-white rounded-lg text-sm font-medium hover:bg-green-700">
|
||||
<Link href="/bulk-import" className="px-4 py-2 bg-green-600 text-white text-sm font-medium hover:bg-green-700">
|
||||
Bulk Import Incidents
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
@@ -82,11 +82,11 @@ export default async function CapaOwnerPage() {
|
||||
</div>
|
||||
|
||||
{activeRows.length === 0 ? (
|
||||
<div className="bg-white rounded-xl shadow-sm p-8 text-center">
|
||||
<div className="bg-surface shadow-sm p-8 text-center">
|
||||
<p className="text-gray-400 text-sm">No active CAPAs assigned to you.</p>
|
||||
</div>
|
||||
) : (
|
||||
<div className="bg-white rounded-xl shadow-sm divide-y divide-gray-50">
|
||||
<div className="bg-surface shadow-sm divide-y divide-gray-50">
|
||||
{activeRows.map(capa => {
|
||||
const isOverdue = isCapaOverdue(capa)
|
||||
return (
|
||||
@@ -127,7 +127,7 @@ export default async function CapaOwnerPage() {
|
||||
{doneRows.length > 0 && (
|
||||
<div className="mt-6">
|
||||
<h2 className="text-xs font-semibold text-gray-400 uppercase tracking-wide mb-2">Completed ({doneCount})</h2>
|
||||
<div className="bg-white rounded-xl shadow-sm divide-y divide-gray-50 opacity-60">
|
||||
<div className="bg-surface shadow-sm divide-y divide-gray-50 opacity-60">
|
||||
{doneRows.map(capa => (
|
||||
<div key={capa.id} className="p-4 flex items-center justify-between">
|
||||
<p className="text-sm text-gray-500 line-clamp-1">{capa.description}</p>
|
||||
|
||||
@@ -62,7 +62,7 @@ export default async function CapaDetailPage({ params }: Props) {
|
||||
← CAPA Board
|
||||
</Link>
|
||||
|
||||
<div className="bg-white rounded-xl shadow-sm p-5 mb-4 space-y-4">
|
||||
<div className="bg-surface shadow-sm p-5 mb-4 space-y-4">
|
||||
<div className="flex items-start justify-between">
|
||||
<div>
|
||||
<p className="text-xs text-gray-500 mb-1">
|
||||
@@ -70,7 +70,7 @@ export default async function CapaDetailPage({ params }: Props) {
|
||||
</p>
|
||||
<p className="text-gray-900 font-medium">{capa.description}</p>
|
||||
</div>
|
||||
<span className={`px-2 py-1 rounded text-xs font-semibold ${PRIORITY_BADGE[capa.priority] ?? ''}`}>
|
||||
<span className={`px-2 py-1 text-xs font-semibold ${PRIORITY_BADGE[capa.priority] ?? ''}`}>
|
||||
{capa.priority}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -165,13 +165,13 @@ export default async function HseDashboardPage({
|
||||
<div className="flex gap-3">
|
||||
<a
|
||||
href="/api/dashboard/export?role=hse"
|
||||
className="text-sm text-gray-500 hover:text-gray-700 border border-gray-200 rounded-lg px-3 py-1.5"
|
||||
className="text-sm text-gray-500 hover:text-gray-700 border border-divider px-3 py-1.5"
|
||||
>
|
||||
Export CSV
|
||||
</a>
|
||||
<a
|
||||
href={`/api/reports/jkkp8?year=${now.getFullYear()}`}
|
||||
className="text-sm text-gray-500 hover:text-gray-700 border border-gray-200 rounded-lg px-3 py-1.5"
|
||||
className="text-sm text-gray-500 hover:text-gray-700 border border-divider px-3 py-1.5"
|
||||
>
|
||||
JKKP 8
|
||||
</a>
|
||||
@@ -187,7 +187,7 @@ export default async function HseDashboardPage({
|
||||
{(tab === 'overview') && (
|
||||
<>
|
||||
{now.getMonth() === 0 && (
|
||||
<div className="bg-amber-50 border border-amber-200 rounded-xl p-4 mb-6">
|
||||
<div className="bg-amber-50 border border-amber-200 p-4 mb-6">
|
||||
<p className="text-sm text-amber-800">
|
||||
<strong>JKKP 8 annual register due:</strong> the {now.getFullYear() - 1} register must be
|
||||
submitted to DOSH before 31 January {now.getFullYear()}.{' '}
|
||||
@@ -210,7 +210,7 @@ export default async function HseDashboardPage({
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="bg-white rounded-xl shadow-sm p-5">
|
||||
<div className="bg-surface shadow-sm p-5">
|
||||
<h2 className="text-sm font-semibold text-gray-900 mb-1">
|
||||
Leading vs Lagging — Last 30 Days
|
||||
</h2>
|
||||
@@ -218,16 +218,16 @@ export default async function HseDashboardPage({
|
||||
Leading: hazard + near-miss reports (predict risk) · Lagging: injuries (past harm)
|
||||
</p>
|
||||
<div className="flex gap-4">
|
||||
<div className="flex-1 text-center bg-blue-50 rounded-lg p-4">
|
||||
<div className="flex-1 text-center bg-blue-50 p-4">
|
||||
<p className="text-3xl font-bold text-blue-600">{leadingCount}</p>
|
||||
<p className="text-xs text-blue-700 mt-1">Leading (Hazards + Near Misses)</p>
|
||||
</div>
|
||||
<div className="flex-1 text-center bg-red-50 rounded-lg 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-xs text-red-700 mt-1">Lagging (Injuries)</p>
|
||||
</div>
|
||||
{capaOnTimeRate !== null && (
|
||||
<div className="flex-1 text-center bg-green-50 rounded-lg p-4">
|
||||
<div className="flex-1 text-center bg-green-50 p-4">
|
||||
<p className="text-3xl font-bold text-green-600">{capaOnTimeRate}%</p>
|
||||
<p className="text-xs text-green-700 mt-1">CAPA On-Time Rate</p>
|
||||
</div>
|
||||
@@ -240,7 +240,7 @@ export default async function HseDashboardPage({
|
||||
{/* Trends tab */}
|
||||
{tab === 'trends' && (
|
||||
<>
|
||||
<div className="bg-white rounded-xl shadow-sm p-5 mb-4">
|
||||
<div className="bg-surface shadow-sm p-5 mb-4">
|
||||
<h2 className="text-sm font-semibold text-gray-900 mb-1">
|
||||
Incident Trend — Last 12 Months
|
||||
</h2>
|
||||
@@ -266,7 +266,7 @@ export default async function HseDashboardPage({
|
||||
</div>
|
||||
|
||||
{rootCauses.length > 0 && (
|
||||
<div className="bg-white rounded-xl shadow-sm p-5">
|
||||
<div className="bg-surface shadow-sm p-5">
|
||||
<h2 className="text-sm font-semibold text-gray-900 mb-4">Top Root Causes</h2>
|
||||
<ol className="space-y-2">
|
||||
{rootCauses.map((rc, i) => (
|
||||
@@ -288,7 +288,7 @@ export default async function HseDashboardPage({
|
||||
{tab === 'zones' && (
|
||||
<>
|
||||
{by_zone.length > 0 && (
|
||||
<div className="bg-white rounded-xl shadow-sm p-5 mb-4">
|
||||
<div className="bg-surface shadow-sm p-5 mb-4">
|
||||
<h2 className="text-sm font-semibold text-gray-900 mb-4">
|
||||
Zone Incident Heatmap — Last 90 Days
|
||||
</h2>
|
||||
@@ -312,7 +312,7 @@ export default async function HseDashboardPage({
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="bg-white rounded-xl shadow-sm p-5 mb-4">
|
||||
<div className="bg-surface shadow-sm p-5 mb-4">
|
||||
<h2 className="text-sm font-semibold text-gray-900 mb-4">By Incident Type</h2>
|
||||
<div className="space-y-2">
|
||||
{Object.entries(by_type).sort((a, b) => b[1] - a[1]).map(([type, count]) => (
|
||||
@@ -333,7 +333,7 @@ export default async function HseDashboardPage({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="bg-white rounded-xl shadow-sm p-5">
|
||||
<div className="bg-surface shadow-sm p-5">
|
||||
<h2 className="text-sm font-semibold text-gray-900 mb-4">By Site</h2>
|
||||
<div className="space-y-2">
|
||||
{by_site.map(({ name, count }) => (
|
||||
|
||||
@@ -175,14 +175,14 @@ export default async function HseIncidentDetailPage({ params }: Props) {
|
||||
<a
|
||||
href={`/api/incidents/${id}/jkkp-pdf?form=jkkp6`}
|
||||
target="_blank"
|
||||
className="inline-block bg-gray-800 text-white rounded-lg px-4 py-2 text-sm font-semibold hover:bg-gray-900"
|
||||
className="inline-block bg-gray-800 text-white px-4 py-2 text-sm font-semibold hover:bg-gray-900"
|
||||
>
|
||||
Download JKKP 6 (PDF)
|
||||
</a>
|
||||
<a
|
||||
href={`/api/incidents/${id}/jkkp-pdf?form=jkkp7`}
|
||||
target="_blank"
|
||||
className="inline-block bg-gray-600 text-white rounded-lg px-4 py-2 text-sm font-semibold hover:bg-gray-700"
|
||||
className="inline-block bg-gray-600 text-white px-4 py-2 text-sm font-semibold hover:bg-gray-700"
|
||||
>
|
||||
Download JKKP 7 (PDF)
|
||||
</a>
|
||||
@@ -194,7 +194,7 @@ export default async function HseIncidentDetailPage({ params }: Props) {
|
||||
href={`/api/incidents/${id}/report-pdf`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="flex items-center gap-1.5 px-3 py-1.5 bg-green-600 text-white text-xs font-semibold rounded-lg hover:bg-green-700 transition-colors"
|
||||
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"
|
||||
>
|
||||
<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" />
|
||||
|
||||
@@ -13,12 +13,12 @@ export default async function HsePage() {
|
||||
<h1 className="text-2xl font-bold text-gray-900 mb-1">HSE Officer Portal</h1>
|
||||
<p className="text-gray-500 text-sm mb-8">Welcome, {session.name}</p>
|
||||
<div className="grid grid-cols-2 gap-4 sm:grid-cols-3">
|
||||
<Link href="/hse/incidents" className="bg-white rounded-xl shadow-sm p-5 hover:shadow-md transition-shadow border border-gray-100">
|
||||
<Link href="/hse/incidents" className="bg-surface shadow-sm p-5 hover:shadow-md transition-shadow border border-divider">
|
||||
<div className="text-2xl mb-2">📋</div>
|
||||
<div className="font-semibold text-gray-900">Incident Inbox</div>
|
||||
<div className="text-xs text-gray-500 mt-1">View all incidents</div>
|
||||
</Link>
|
||||
<Link href="/hse/dashboard" className="bg-white rounded-xl shadow-sm p-5 hover:shadow-md transition-shadow border border-gray-100">
|
||||
<Link href="/hse/dashboard" className="bg-surface shadow-sm p-5 hover:shadow-md transition-shadow border border-divider">
|
||||
<div className="text-2xl mb-2">📊</div>
|
||||
<div className="font-semibold text-gray-900">Dashboard</div>
|
||||
<div className="text-xs text-gray-500 mt-1">Stats & overview</div>
|
||||
|
||||
@@ -97,7 +97,7 @@ export default async function ManagementPage() {
|
||||
<h1 className="text-2xl font-bold text-gray-900">Management Dashboard</h1>
|
||||
<a
|
||||
href="/api/dashboard/export?role=management"
|
||||
className="text-sm text-gray-500 hover:text-gray-700 border border-gray-200 rounded-lg px-3 py-1.5"
|
||||
className="text-sm text-gray-500 hover:text-gray-700 border border-divider px-3 py-1.5"
|
||||
>
|
||||
Export CSV
|
||||
</a>
|
||||
@@ -119,15 +119,15 @@ export default async function ManagementPage() {
|
||||
</div>
|
||||
|
||||
{/* Leading vs lagging */}
|
||||
<div className="bg-white rounded-xl shadow-sm p-5 mb-4">
|
||||
<div className="bg-surface shadow-sm p-5 mb-4">
|
||||
<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>
|
||||
<div className="flex gap-6">
|
||||
<div className="flex-1 text-center bg-blue-50 rounded-lg p-4">
|
||||
<div className="flex-1 text-center bg-blue-50 p-4">
|
||||
<p className="text-3xl font-bold text-blue-600">{leadingCount}</p>
|
||||
<p className="text-xs text-blue-700 mt-1">Leading (Hazards + Near Misses)</p>
|
||||
</div>
|
||||
<div className="flex-1 text-center bg-red-50 rounded-lg 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-xs text-red-700 mt-1">Lagging (Injuries)</p>
|
||||
</div>
|
||||
@@ -135,7 +135,7 @@ export default async function ManagementPage() {
|
||||
</div>
|
||||
|
||||
{/* Severity distribution */}
|
||||
<div className="bg-white rounded-xl shadow-sm p-5 mb-4">
|
||||
<div className="bg-surface shadow-sm p-5 mb-4">
|
||||
<h2 className="text-sm font-semibold text-gray-700 uppercase tracking-wide mb-4">Severity Distribution (All Time)</h2>
|
||||
<div className="space-y-2">
|
||||
{([5, 4, 3, 2, 1] as const).map(sev => (
|
||||
@@ -154,7 +154,7 @@ export default async function ManagementPage() {
|
||||
</div>
|
||||
|
||||
{/* Site comparison */}
|
||||
<div className="bg-white rounded-xl shadow-sm p-5">
|
||||
<div className="bg-surface shadow-sm p-5">
|
||||
<h2 className="text-sm font-semibold text-gray-700 uppercase tracking-wide mb-4">Incidents by Site</h2>
|
||||
{by_site.length === 0 ? (
|
||||
<p className="text-sm text-gray-400">No data</p>
|
||||
|
||||
@@ -68,7 +68,7 @@ export default async function ReporterIncidentDetail({
|
||||
<Link href="/reporter" className="text-sm text-blue-600 hover:underline">← My Reports</Link>
|
||||
</div>
|
||||
|
||||
<div className="bg-white rounded-xl shadow-sm p-5">
|
||||
<div className="bg-surface shadow-sm p-5">
|
||||
<div className="flex items-start justify-between gap-3 mb-4">
|
||||
<div>
|
||||
<h1 className="text-lg font-bold text-gray-900">{inc.referenceNo ?? inc.id.slice(0, 8)}</h1>
|
||||
@@ -98,7 +98,7 @@ export default async function ReporterIncidentDetail({
|
||||
</div>
|
||||
|
||||
{inc.description && (
|
||||
<div className="border-t border-gray-100 pt-4">
|
||||
<div className="border-t border-divider pt-4">
|
||||
<p className="text-xs text-gray-500 mb-1">Description</p>
|
||||
<p className="text-sm text-gray-800 whitespace-pre-line">{inc.description}</p>
|
||||
</div>
|
||||
@@ -106,17 +106,17 @@ export default async function ReporterIncidentDetail({
|
||||
</div>
|
||||
|
||||
{capas.length > 0 && (
|
||||
<div className="bg-white rounded-xl shadow-sm p-5">
|
||||
<div className="bg-surface shadow-sm p-5">
|
||||
<h2 className="text-sm font-semibold text-gray-900 mb-3">Corrective Actions ({capas.length})</h2>
|
||||
<div className="space-y-2">
|
||||
{capas.map(c => (
|
||||
<div key={c.id} className="flex items-start justify-between gap-3 text-sm">
|
||||
<p className="text-gray-700 flex-1">{c.description}</p>
|
||||
<span className={`text-xs rounded-full px-2 py-0.5 shrink-0 ${
|
||||
c.status === 'verified' ? 'bg-green-100 text-green-700' :
|
||||
c.status === 'pending_verification' ? 'bg-purple-100 text-purple-700' :
|
||||
'bg-gray-100 text-gray-600'
|
||||
}`}>{c.status.replace(/_/g, ' ')}</span>
|
||||
c.status === 'verified' ? 'bg-green-100 text-green-700' :
|
||||
c.status === 'pending_verification' ? 'bg-purple-100 text-purple-700' :
|
||||
'bg-gray-100 text-gray-600'
|
||||
}`}>{c.status.replace(/_/g, ' ')}</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -62,34 +62,34 @@ export default async function ReporterPage() {
|
||||
</div>
|
||||
<Link
|
||||
href="/report"
|
||||
className="bg-blue-600 text-white rounded-lg px-4 py-2 text-sm font-semibold hover:bg-blue-700"
|
||||
className="bg-blue-600 text-white px-4 py-2 text-sm font-semibold hover:bg-blue-700"
|
||||
>
|
||||
+ New Report
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
<div className="flex gap-4 mb-6 text-sm">
|
||||
<div className="bg-white rounded-xl 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-gray-900">{rows.length}</p>
|
||||
<p className="text-xs text-gray-500 mt-1">Total Submitted</p>
|
||||
</div>
|
||||
<div className="bg-white rounded-xl 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-xs text-gray-500 mt-1">In Progress</p>
|
||||
</div>
|
||||
<div className="bg-white rounded-xl 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-xs text-gray-500 mt-1">Closed</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{rows.length === 0 ? (
|
||||
<div className="bg-white rounded-xl 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>
|
||||
<Link href="/report" className="text-blue-600 text-sm hover:underline">Submit your first report →</Link>
|
||||
</div>
|
||||
) : (
|
||||
<div className="bg-white rounded-xl shadow-sm divide-y divide-gray-50">
|
||||
<div className="bg-surface shadow-sm divide-y divide-gray-50">
|
||||
{rows.map(inc => (
|
||||
<Link key={inc.id} href={`/reporter/incidents/${inc.id}`} className="block p-4 cursor-pointer hover:bg-gray-50 transition-colors">
|
||||
<div className="flex items-start justify-between gap-3">
|
||||
|
||||
@@ -133,7 +133,7 @@ export default async function SupervisorPage() {
|
||||
</div>
|
||||
|
||||
{/* Open incidents */}
|
||||
<div className="bg-white rounded-xl shadow-sm p-5 mb-4">
|
||||
<div className="bg-surface shadow-sm p-5 mb-4">
|
||||
<h2 className="text-sm font-semibold text-gray-700 uppercase tracking-wide mb-4">Open Incidents</h2>
|
||||
{openIncidents.length === 0 ? (
|
||||
<p className="text-sm text-gray-400">No open incidents.</p>
|
||||
@@ -143,7 +143,7 @@ export default async function SupervisorPage() {
|
||||
<Link
|
||||
key={inc.id}
|
||||
href={`/supervisor/incidents/${inc.id}`}
|
||||
className="flex items-center justify-between py-2 border-b border-gray-50 last:border-0 hover:bg-gray-50 -mx-2 px-2 rounded"
|
||||
className="flex items-center justify-between py-2 border-b border-gray-50 last:border-0 hover:bg-gray-50 -mx-2 px-2"
|
||||
>
|
||||
<div>
|
||||
<p className="text-sm font-medium text-gray-900">{inc.referenceNo ?? inc.id.slice(0, 8)}</p>
|
||||
@@ -160,7 +160,7 @@ export default async function SupervisorPage() {
|
||||
|
||||
{/* Overdue CAPAs */}
|
||||
{overdueCount > 0 && (
|
||||
<div className="bg-white rounded-xl shadow-sm p-5">
|
||||
<div className="bg-surface shadow-sm p-5">
|
||||
<h2 className="text-sm font-semibold text-red-600 uppercase tracking-wide mb-4">Overdue CAPAs</h2>
|
||||
<div className="space-y-2">
|
||||
{overdueCapas.map(capa => (
|
||||
|
||||
Reference in New Issue
Block a user