From 82bf7c6078d7073c12813f167dfc28d3c3fb42a5 Mon Sep 17 00:00:00 2001 From: "groombook-engineer[bot]" <3141748+groombook-engineer[bot]@users.noreply.github.com> Date: Wed, 1 Apr 2026 19:39:21 +0000 Subject: [PATCH] fix(ui): replace Super User and Status action buttons with inline toggles - Super User column now has an inline toggle switch instead of a badge + Grant/Revoke button - Status column now has an inline toggle switch instead of a badge + Deactivate/Activate button - Actions column now only has Edit button; Grant SU, Revoke SU, Deactivate, Activate removed - Both toggles disabled when staff member is the last active super user - Loading indicator shown while toggling (togglingId === s.id) - No new dependencies; styled button toggle consistent with existing inline styles Co-Authored-By: Paperclip --- apps/web/src/pages/Staff.tsx | 108 +++++++++++++++++++++++++++-------- 1 file changed, 84 insertions(+), 24 deletions(-) diff --git a/apps/web/src/pages/Staff.tsx b/apps/web/src/pages/Staff.tsx index a521e1c..f338338 100644 --- a/apps/web/src/pages/Staff.tsx +++ b/apps/web/src/pages/Staff.tsx @@ -75,8 +75,19 @@ export function StaffPage() { } async function toggleActive(s: Staff) { - await fetch(`/api/staff/${s.id}`, { method: "PATCH", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ active: !s.active }) }); - await load(); + setTogglingId(s.id); + setToggleError(null); + try { + const res = await fetch(`/api/staff/${s.id}`, { method: "PATCH", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ active: !s.active }) }); + if (!res.ok) { + const err = (await res.json()) as { error?: string }; + setToggleError(err.error ?? `HTTP ${res.status}`); + return; + } + await load(); + } finally { + setTogglingId(null); + } } async function toggleSuperUser(s: Staff) { @@ -137,34 +148,83 @@ export function StaffPage() { {s.email} {s.role} - {s.isSuperUser ? ( - - Super User - + {currentUser?.isSuperUser ? ( + ) : ( - + s.isSuperUser ? ( + Super User + ) : ( + + ) )} - - {s.active ? "Active" : "Inactive"} - + - {currentUser?.isSuperUser && ( - <> - - - )} - - + ))}