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:
@@ -31,15 +31,15 @@ export function AdminPanel({ users, sites, siteOptions, trucks }: Props) {
|
||||
key={t.id}
|
||||
onClick={() => setTab(t.id)}
|
||||
className={`px-4 py-2.5 text-sm font-medium border-b-2 -mb-px transition-colors cursor-pointer ${
|
||||
tab === t.id
|
||||
? 'border-green-600 text-green-700'
|
||||
: 'border-transparent text-gray-500 hover:text-gray-700'
|
||||
}`}
|
||||
tab === t.id
|
||||
? 'border-accent text-ink'
|
||||
: 'border-transparent text-gray-500 hover:text-gray-700'
|
||||
}`}
|
||||
>
|
||||
{t.label}
|
||||
<span className={`ml-1.5 text-xs px-1.5 py-0.5 rounded-full ${
|
||||
tab === t.id ? 'bg-green-100 text-green-700' : 'bg-gray-100 text-gray-500'
|
||||
}`}>{t.count}</span>
|
||||
<span className={`ml-1.5 text-xs px-1.5 py-0.5 ${
|
||||
tab === t.id ? 'bg-neutral-100 text-ink' : 'bg-gray-100 text-gray-500'
|
||||
}`}>{t.count}</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -208,7 +208,7 @@ export function BulkImportForm() {
|
||||
<button
|
||||
onClick={handleImport}
|
||||
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'}
|
||||
</button>
|
||||
@@ -220,9 +220,9 @@ export function BulkImportForm() {
|
||||
|
||||
return (
|
||||
<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>
|
||||
{message && <p className="text-green-600 text-sm">{message}</p>}
|
||||
{message && <p className="text-ink text-sm">{message}</p>}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import { useState } from 'react'
|
||||
import { useRouter } from 'next/navigation'
|
||||
import { Modal } from '@/components/ui/modal'
|
||||
import { INPUT_CLASS as inp } from '@/components/ui/field'
|
||||
|
||||
export type SiteWithZones = {
|
||||
id: string
|
||||
@@ -16,7 +17,6 @@ interface Props {
|
||||
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'
|
||||
|
||||
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
|
||||
</button>
|
||||
<button onClick={() => { setShowAddSite(true); setError(null) }}
|
||||
className="flex items-center gap-1.5 px-3 py-1.5 bg-green-600 text-white text-xs font-semibold 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}>
|
||||
<path strokeLinecap="round" strokeLinejoin="round" d="M12 4v16m8-8H4" />
|
||||
</svg>
|
||||
@@ -118,11 +118,11 @@ export function SiteZoneManager({ sites }: Props) {
|
||||
<div className="flex items-center gap-2">
|
||||
<button disabled={busyId === site.id}
|
||||
onClick={() => send('PATCH', { kind: 'site', id: site.id, active: !site.active })}
|
||||
className={`text-xs font-medium px-2.5 py-1 rounded-full border transition-colors cursor-pointer disabled:opacity-50 ${
|
||||
site.active
|
||||
? 'bg-green-50 text-green-700 border-green-200 hover:bg-green-100'
|
||||
: 'bg-gray-50 text-gray-500 border-divider hover:bg-gray-100'
|
||||
}`}>
|
||||
className={`text-xs font-medium px-2.5 py-1 border transition-colors cursor-pointer disabled:opacity-50 ${
|
||||
site.active
|
||||
? 'bg-neutral-100 text-ink border-divider hover:bg-neutral-200'
|
||||
: 'bg-gray-50 text-gray-500 border-divider hover:bg-gray-100'
|
||||
}`}>
|
||||
{site.active ? 'Active' : 'Inactive'}
|
||||
</button>
|
||||
<button disabled={busyId === site.id}
|
||||
@@ -140,16 +140,16 @@ export function SiteZoneManager({ sites }: Props) {
|
||||
<span className="text-xs text-gray-700 font-medium">{z.name}</span>
|
||||
<div className="flex items-center gap-3">
|
||||
<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
|
||||
</a>
|
||||
<button disabled={busyId === z.id}
|
||||
onClick={() => send('PATCH', { kind: 'zone', id: z.id, active: !z.active })}
|
||||
className={`text-xs font-medium px-2 py-0.5 rounded-full border transition-colors cursor-pointer disabled:opacity-50 ${
|
||||
z.active
|
||||
? 'bg-green-50 text-green-700 border-green-200 hover:bg-green-100'
|
||||
: 'bg-gray-50 text-gray-500 border-divider hover:bg-gray-100'
|
||||
}`}>
|
||||
className={`text-xs font-medium px-2 py-0.5 border transition-colors cursor-pointer disabled:opacity-50 ${
|
||||
z.active
|
||||
? 'bg-neutral-100 text-ink border-divider hover:bg-neutral-200'
|
||||
: 'bg-gray-50 text-gray-500 border-divider hover:bg-gray-100'
|
||||
}`}>
|
||||
{z.active ? 'Active' : 'Inactive'}
|
||||
</button>
|
||||
<button disabled={busyId === z.id}
|
||||
@@ -183,7 +183,7 @@ export function SiteZoneManager({ sites }: Props) {
|
||||
</button>
|
||||
<button disabled={busy || !siteName.trim()}
|
||||
onClick={async () => { if (await post({ kind: 'site', name: siteName })) { setSiteName(''); setShowAddSite(false) } }}
|
||||
className="px-4 py-2 bg-green-600 text-white text-sm font-semibold 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'}
|
||||
</button>
|
||||
</>
|
||||
@@ -214,7 +214,7 @@ export function SiteZoneManager({ sites }: Props) {
|
||||
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'}
|
||||
</button>
|
||||
</>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import { useState } from 'react'
|
||||
import { useRouter } from 'next/navigation'
|
||||
import { Modal } from '@/components/ui/modal'
|
||||
import { INPUT_CLASS as inp } from '@/components/ui/field'
|
||||
|
||||
export type Truck = {
|
||||
id: string
|
||||
@@ -15,7 +16,6 @@ interface Props {
|
||||
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'
|
||||
|
||||
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>
|
||||
</div>
|
||||
<button onClick={() => { setShowAdd(true); setError(null) }}
|
||||
className="flex items-center gap-1.5 px-3 py-1.5 bg-green-600 text-white text-xs font-semibold 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}>
|
||||
<path strokeLinecap="round" strokeLinejoin="round" d="M12 4v16m8-8H4" />
|
||||
</svg>
|
||||
@@ -109,16 +109,16 @@ export function TruckManager({ trucks }: Props) {
|
||||
</div>
|
||||
<div className="flex items-center gap-3">
|
||||
<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
|
||||
</a>
|
||||
<button disabled={busyId === tk.id}
|
||||
onClick={() => send('PATCH', { id: tk.id, active: !tk.active })}
|
||||
className={`text-xs font-medium px-2.5 py-1 rounded-full border transition-colors cursor-pointer disabled:opacity-50 ${
|
||||
tk.active
|
||||
? 'bg-green-50 text-green-700 border-green-200 hover:bg-green-100'
|
||||
: 'bg-gray-50 text-gray-500 border-divider hover:bg-gray-100'
|
||||
}`}>
|
||||
className={`text-xs font-medium px-2.5 py-1 border transition-colors cursor-pointer disabled:opacity-50 ${
|
||||
tk.active
|
||||
? 'bg-neutral-100 text-ink border-divider hover:bg-neutral-200'
|
||||
: 'bg-gray-50 text-gray-500 border-divider hover:bg-gray-100'
|
||||
}`}>
|
||||
{tk.active ? 'Active' : 'Inactive'}
|
||||
</button>
|
||||
<button disabled={busyId === tk.id} onClick={() => setConfirmDelete(tk)}
|
||||
@@ -143,7 +143,7 @@ export function TruckManager({ trucks }: Props) {
|
||||
Cancel
|
||||
</button>
|
||||
<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'}
|
||||
</button>
|
||||
</>
|
||||
|
||||
@@ -4,6 +4,7 @@ import { useState } from 'react'
|
||||
import { useRouter } from 'next/navigation'
|
||||
import { ALL_ROLES, type UserRole } from '@/lib/auth/roles'
|
||||
import { Modal } from '@/components/ui/modal'
|
||||
import { INPUT_CLASS as inp } from '@/components/ui/field'
|
||||
|
||||
export type AdminUser = {
|
||||
id: string
|
||||
@@ -24,7 +25,6 @@ interface Props {
|
||||
|
||||
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'
|
||||
|
||||
export function UserManager({ users, sites }: Props) {
|
||||
@@ -103,7 +103,7 @@ export function UserManager({ users, sites }: Props) {
|
||||
</div>
|
||||
<button
|
||||
onClick={() => { setShowAdd(true); setError(null) }}
|
||||
className="flex items-center gap-1.5 px-3 py-1.5 bg-green-600 text-white text-xs font-semibold 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}>
|
||||
<path strokeLinecap="round" strokeLinejoin="round" d="M12 4v16m8-8H4" />
|
||||
@@ -134,14 +134,14 @@ export function UserManager({ users, sites }: Props) {
|
||||
<td className="px-5 py-3">
|
||||
<select value={u.role} disabled={busyId === u.id}
|
||||
onChange={e => patchUser(u.id, { role: e.target.value })}
|
||||
className="border border-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>)}
|
||||
</select>
|
||||
</td>
|
||||
<td className="px-5 py-3">
|
||||
<select value={u.site_id ?? ''} disabled={busyId === u.id}
|
||||
onChange={e => patchUser(u.id, { site_id: e.target.value || null })}
|
||||
className="border border-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>
|
||||
{sites.map(s => <option key={s.id} value={s.id}>{s.name}</option>)}
|
||||
</select>
|
||||
@@ -149,11 +149,11 @@ export function UserManager({ users, sites }: Props) {
|
||||
<td className="px-5 py-3">
|
||||
<button disabled={busyId === u.id}
|
||||
onClick={() => patchUser(u.id, { active: !u.active })}
|
||||
className={`text-xs px-2.5 py-1 rounded-full font-medium border transition-colors cursor-pointer ${
|
||||
u.active
|
||||
? 'bg-green-50 text-green-700 border-green-200 hover:bg-green-100'
|
||||
: 'bg-gray-50 text-gray-500 border-divider hover:bg-gray-100'
|
||||
}`}>
|
||||
className={`text-xs px-2.5 py-1 font-medium border transition-colors cursor-pointer ${
|
||||
u.active
|
||||
? 'bg-neutral-100 text-ink border-divider hover:bg-neutral-200'
|
||||
: 'bg-gray-50 text-gray-500 border-divider hover:bg-gray-100'
|
||||
}`}>
|
||||
{u.active ? 'Active' : 'Inactive'}
|
||||
</button>
|
||||
</td>
|
||||
@@ -182,7 +182,7 @@ export function UserManager({ users, sites }: Props) {
|
||||
Cancel
|
||||
</button>
|
||||
<button form="add-user-form" type="submit" disabled={submitting}
|
||||
className="px-4 py-2 bg-green-600 text-white text-sm font-semibold 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'}
|
||||
</button>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user