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:
@@ -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