feat(design): colour banners and badges by meaning, document slice 1 and update design notes
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -91,7 +91,7 @@ Source of truth: `design-system/design.md`. Visual references: `design-system/IM
|
|||||||
- Incident evidence photos stay full colour.
|
- Incident evidence photos stay full colour.
|
||||||
- New pattern needed? Check design.md first. If it isn't there, design it in the design tool, then add it to design.md in the same PR as the component.
|
- New pattern needed? Check design.md first. If it isn't there, design it in the design tool, then add it to design.md in the same PR as the component.
|
||||||
- Gotcha: never write `*/` inside a CSS comment in `globals.css`; it ends the comment and silently swallows the `@theme` block.
|
- Gotcha: never write `*/` inside a CSS comment in `globals.css`; it ends the comment and silently swallows the `@theme` block.
|
||||||
- Run `npm run check:design` before committing UI changes; it must print `design gates: clean`. Update `scripts/check-design-gates.mjs` first: allow `rounded-*`, flag `border-b-2`/`border-2`, flag Archivo and `#ec3013`.
|
- Run `npm run check:design` before committing UI changes; it must print `design gates: clean`. The gate flags 2px borders, `Archivo`, hard-coded hex, `bg-white`, `shadow-xl/2xl`, centered button labels and off-palette hues; rounded corners are allowed. Extend `scripts/check-design-gates.mjs` when design.md adds a rule.
|
||||||
|
|
||||||
## graphify
|
## graphify
|
||||||
When graphify-out/graph.json exists:
|
When graphify-out/graph.json exists:
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ export default async function LoginPage({ searchParams }: Props) {
|
|||||||
return (
|
return (
|
||||||
<main className="min-h-screen flex items-center justify-center bg-ground 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-neutral-100 border border-divider text-ink text-sm px-4 py-2 shadow">
|
<div className="fixed top-4 left-1/2 -translate-x-1/2 bg-st-green-bg text-st-green-fg text-[13px] px-4 py-2 rounded-md shadow-float">
|
||||||
Password updated — sign in with your new password.
|
Password updated — sign in with your new password.
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className="bg-surface border border-divider p-8 w-full max-w-sm">
|
<div className="bg-surface rounded-xl shadow-card p-8 w-full max-w-sm">
|
||||||
<LoginForm />
|
<LoginForm />
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
@@ -187,8 +187,8 @@ export default async function HseDashboardPage({
|
|||||||
{(tab === 'overview') && (
|
{(tab === 'overview') && (
|
||||||
<>
|
<>
|
||||||
{now.getMonth() === 0 && (
|
{now.getMonth() === 0 && (
|
||||||
<div className="bg-accent-100 border border-accent-300 p-4 mb-6">
|
<div className="bg-st-amber-bg rounded-xl p-4 mb-6">
|
||||||
<p className="text-sm text-accent-700">
|
<p className="text-sm text-st-amber-fg">
|
||||||
<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">
|
||||||
|
|||||||
@@ -106,9 +106,9 @@ export default async function ReporterIncidentDetail({
|
|||||||
<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 px-2 py-0.5 shrink-0 ${
|
<span className={`text-xs px-2 py-0.5 shrink-0 ${
|
||||||
c.status === 'verified' ? 'bg-neutral-100 text-ink' :
|
c.status === 'verified' ? 'bg-st-green-bg text-st-green-fg' :
|
||||||
c.status === 'pending_verification' ? 'bg-accent-100 text-accent-700' :
|
c.status === 'pending_verification' ? 'bg-st-indigo-bg text-st-indigo-fg' :
|
||||||
'bg-gray-100 text-gray-600'
|
'bg-st-grey-bg text-st-grey-fg'
|
||||||
}`}>{c.status.replace(/_/g, ' ')}</span>
|
}`}>{c.status.replace(/_/g, ' ')}</span>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -39,13 +39,13 @@ 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="pb-3 border-b border-divider">
|
<div className="pb-3 border-b border-rule">
|
||||||
<h1 className="text-3xl font-extrabold">IMS</h1>
|
<h1 className="text-[22px] font-[650]">IMS</h1>
|
||||||
<p className="text-sm text-ink/60 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-accent-100 border border-accent text-accent-800 text-sm px-3 py-2">
|
<p className="bg-st-red-bg text-st-red-fg text-[13px] px-3 py-2 rounded-md">
|
||||||
{error}
|
{error}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ type RiskFlag = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const LEVEL_COLORS: Record<RiskFlag['risk_level'], string> = {
|
const LEVEL_COLORS: Record<RiskFlag['risk_level'], string> = {
|
||||||
low: 'bg-neutral-100 text-neutral-800 border-divider',
|
low: 'bg-st-grey-bg text-st-grey-fg border-transparent',
|
||||||
medium: 'bg-ground text-accent-700 border-accent',
|
medium: 'bg-st-amber-bg text-st-amber-fg border-transparent',
|
||||||
high: 'bg-accent-100 text-accent-800 border-accent',
|
high: 'bg-st-red-bg text-st-red-fg border-transparent',
|
||||||
}
|
}
|
||||||
|
|
||||||
export function RiskFlagsPanel() {
|
export function RiskFlagsPanel() {
|
||||||
@@ -71,7 +71,7 @@ export function RiskFlagsPanel() {
|
|||||||
<p className="text-sm text-gray-700 mb-3">{summary}</p>
|
<p className="text-sm text-gray-700 mb-3">{summary}</p>
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
{flags.map(f => (
|
{flags.map(f => (
|
||||||
<div key={`${f.site}-${f.zone}`} className={`border p-3 ${LEVEL_COLORS[f.risk_level]}`}>
|
<div key={`${f.site}-${f.zone}`} className={`border rounded-md p-3 ${LEVEL_COLORS[f.risk_level]}`}>
|
||||||
<div className="flex items-center justify-between mb-1">
|
<div className="flex items-center justify-between mb-1">
|
||||||
<span className="text-sm font-semibold">{f.zone} · {f.site}</span>
|
<span className="text-sm font-semibold">{f.zone} · {f.site}</span>
|
||||||
<span className="text-xs font-bold uppercase">{f.risk_level}</span>
|
<span className="text-xs font-bold uppercase">{f.risk_level}</span>
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ export function InvestigationPanel({ investigation: inv }: Props) {
|
|||||||
<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 ${
|
<span className={`text-xs font-medium px-2 py-0.5 ${
|
||||||
inv.completed_at
|
inv.completed_at
|
||||||
? 'bg-neutral-100 text-ink'
|
? 'bg-st-green-bg text-st-green-fg'
|
||||||
: 'bg-accent-100 text-accent-700'
|
: 'bg-st-blue-bg text-st-blue-fg'
|
||||||
}`}>
|
}`}>
|
||||||
{inv.completed_at ? 'Completed' : 'In Progress'}
|
{inv.completed_at ? 'Completed' : 'In Progress'}
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ 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-accent-100 border border-accent-300 p-3 flex items-center justify-between shadow-md z-50">
|
<div className="fixed bottom-4 left-4 right-4 bg-st-amber-bg rounded-xl p-3 flex items-center justify-between shadow-float z-50">
|
||||||
<span className="text-sm text-accent-700 font-medium">
|
<span className="text-sm text-st-amber-fg font-medium">
|
||||||
{pendingCount} report{pendingCount > 1 ? 's' : ''} saved offline
|
{pendingCount} report{pendingCount > 1 ? 's' : ''} saved offline
|
||||||
</span>
|
</span>
|
||||||
<button
|
<button
|
||||||
|
|||||||
@@ -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-accent-100 border border-accent-300 p-3 text-sm text-accent-700">
|
<div className="bg-st-amber-bg rounded-md p-3 text-sm text-st-amber-fg">
|
||||||
{t.offlineBanner}
|
{t.offlineBanner}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@@ -308,15 +308,15 @@ export function ReportForm({ zoneToken, trucks, initialTruckId }: Props) {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{qualityCheck && !qualityCheck.passes && (
|
{qualityCheck && !qualityCheck.passes && (
|
||||||
<div className="bg-accent-100 border border-accent-300 p-3 space-y-2">
|
<div className="bg-st-amber-bg rounded-md p-3 space-y-2">
|
||||||
<p className="text-xs font-semibold text-accent-700 uppercase tracking-wide">
|
<p className="text-xs font-semibold text-st-amber-fg uppercase tracking-wide">
|
||||||
{t.qualityScoreLabel.replace('{score}', String(qualityCheck.score))}
|
{t.qualityScoreLabel.replace('{score}', String(qualityCheck.score))}
|
||||||
</p>
|
</p>
|
||||||
<p className="text-sm text-accent-700">{qualityCheck.feedback}</p>
|
<p className="text-sm text-st-amber-fg">{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-accent-700">{s}</li>
|
<li key={i} className="text-xs text-st-amber-fg">{s}</li>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ export function TriageForm({ incidentId, currentSeverity }: Props) {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{aiRationale && (
|
{aiRationale && (
|
||||||
<div className="bg-accent-100 border border-accent-300 p-3">
|
<div className="bg-accent-tint rounded-md p-3">
|
||||||
<p className="text-xs font-semibold text-accent-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-accent-700">{aiRationale}</p>
|
<p className="text-xs text-accent-700">{aiRationale}</p>
|
||||||
<p className="text-xs text-accent-400 mt-1">Fields pre-filled — review before submitting.</p>
|
<p className="text-xs text-accent-400 mt-1">Fields pre-filled — review before submitting.</p>
|
||||||
|
|||||||
@@ -49,8 +49,8 @@ export function ApiKeyForm({ settings }: Props) {
|
|||||||
<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 ${
|
<span className={`text-xs font-medium px-2 py-0.5 ${
|
||||||
status?.set
|
status?.set
|
||||||
? 'bg-neutral-100 text-ink'
|
? 'bg-st-green-bg text-st-green-fg'
|
||||||
: 'bg-accent-100 text-accent-700'
|
: 'bg-st-amber-bg text-st-amber-fg'
|
||||||
}`}>
|
}`}>
|
||||||
{status?.set ? 'Configured' : 'Not set'}
|
{status?.set ? 'Configured' : 'Not set'}
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ Pill: `inline-flex`, padding 2px 8px, radius 8, 12px/550, no wrap. Dark text on
|
|||||||
| Verified | `#d7f4e3` | `#0c5132` |
|
| Verified | `#d7f4e3` | `#0c5132` |
|
||||||
| Reopened | `#fee3e0` | `#8e1f0b` |
|
| Reopened | `#fee3e0` | `#8e1f0b` |
|
||||||
|
|
||||||
Mapping from the data model: incident `reported/triaged/investigating/capa_pending/verification/closed` use the matching rows; CAPA `open/in_progress/overdue/pending_verification/verified/reopened/closed` map to Open, In progress, Overdue, Verification, Verified, Reopened, Closed; priority `high/med/low` map to High, Medium, Low. Severity 5 and Critical use the Overdue / Critical row. Tailwind: `st-<name>-bg` / `st-<name>-fg` pairs. No icon required; the text label is always present.
|
Mapping from the data model: incident `reported/triaged/investigating/capa_pending/verification/closed` use the matching rows; CAPA `open/in_progress/overdue/pending_verification/verified/reopened/closed` map to Open, In progress, Overdue, Verification, Verified, Reopened, Closed; priority `high/med/low` map to High, Medium, Low. Severity 5 and Critical use the Overdue / Critical row. Tailwind: one pair per hue, `bg-st-<hue>-bg` / `text-st-<hue>-fg`, hue in `amber blue violet orange indigo green grey red`; `StatusTag` maps each status to a hue (reported amber, triaged blue, investigating violet, capa_pending orange, verification and pending_verification indigo, closed and verified green, open and low grey, in_progress blue, overdue and reopened red, high orange, med amber). Banners follow the same pairs: error red, warning or offline amber, success green; AI suggestions and hints use `bg-accent-tint`. No icon required; the text label is always present.
|
||||||
|
|
||||||
### 4.3 FilterChip
|
### 4.3 FilterChip
|
||||||
28px, radius 8, 12.5px, padding 0 10px. Unset: white, ring `#d4d4d4`, text `#303030`, trailing 12px chevron. Set: `accent-tint-2`, ring `#9fd3c7`, text `#0b4f47`, shows "Label: value" and a clear x.
|
28px, radius 8, 12.5px, padding 0 10px. Unset: white, ring `#d4d4d4`, text `#303030`, trailing 12px chevron. Set: `accent-tint-2`, ring `#9fd3c7`, text `#0b4f47`, shows "Label: value" and a clear x.
|
||||||
@@ -193,6 +193,8 @@ This file covers look and component structure. Routes, queries, permissions and
|
|||||||
5. **Migrate the Incidents list** (screen 01 and 10) as the first full screen.
|
5. **Migrate the Incidents list** (screen 01 and 10) as the first full screen.
|
||||||
6. **Remaining screens**, in §5 order, one plan per group.
|
6. **Remaining screens**, in §5 order, one plan per group.
|
||||||
|
|
||||||
|
Slice 1 (gate, tokens, primitives, TableCard, shells, Incidents list) is implemented; the remaining screens follow in later plans.
|
||||||
|
|
||||||
Gate first: before step 1, update `scripts/check-design-gates.mjs` to allow `rounded-*`, flag `border-b-2` and `border-2`, and flag Archivo and `#ec3013`. `npm run check:design` must pass at the end of each step.
|
Gate first: before step 1, update `scripts/check-design-gates.mjs` to allow `rounded-*`, flag `border-b-2` and `border-2`, and flag Archivo and `#ec3013`. `npm run check:design` must pass at the end of each step.
|
||||||
|
|
||||||
## 9. What changes from the live Modernist build
|
## 9. What changes from the live Modernist build
|
||||||
|
|||||||
Reference in New Issue
Block a user