From d8fcdc466244c887c0914beda0075b2bcda54926 Mon Sep 17 00:00:00 2001 From: Riyadh Date: Thu, 21 May 2026 08:57:08 +0000 Subject: [PATCH] Unify edit-role dialog with AdminFormDialog (#621) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The "edit role" dialog in admin.tsx was hand-rolled as a bespoke
with its own close button, sticky footer and full-width split buttons. That made it look different from every other admin dialog (add role, add/edit group, add user), and on iPad the action buttons floated mid-dialog because the content exceeded max-h-[92vh]. The custom wrapper also lacked role="dialog", so the new `:has(:focus)` CSS keyboard rule (index.css:492) never applied to it. Replaced the wrapper with AdminFormDialog (maxWidth="lg", KeyRound icon, same title key). All inner content — name/desc fields, rename warning, permissions list, removal impact, RolePermissionHistory, RecentActivityForTarget — moved verbatim as children. Removed the custom sticky footer; AdminFormDialog provides the unified footer with cancel/save buttons. Preserved testIds `edit-role-dialog` and `edit-role-submit`. Disabled logic translated 1:1 into submitDisabled + isPending props (note: `impactError` coerced to boolean via `!!` to satisfy the prop type). No behavior change: same handlers (closeEditDialog, handleEdit), same loading spinner, same disabled conditions. Bonus: the keyboard override CSS now applies because AdminFormDialog already sets role="dialog". `tsc --noEmit` clean. --- artifacts/tx-os/src/pages/admin.tsx | 55 +++++++++-------------------- 1 file changed, 17 insertions(+), 38 deletions(-) diff --git a/artifacts/tx-os/src/pages/admin.tsx b/artifacts/tx-os/src/pages/admin.tsx index 29c80187..aaa7e7e8 100644 --- a/artifacts/tx-os/src/pages/admin.tsx +++ b/artifacts/tx-os/src/pages/admin.tsx @@ -6867,20 +6867,21 @@ function RolesPanel({ )} {editingId != null && ( -
-
- -

{t("admin.roles.editRole")}

+ } + maxWidth="lg" + onCancel={closeEditDialog} + onSubmit={handleEdit} + submitDisabled={ + !editForm.name.trim() || + (!editingIsSystem && hasRemovals && (impactLoading || !!impactError)) + } + isPending={updateRole.isPending || replaceRolePermissions.isPending} + testId="edit-role-dialog" + submitTestId="edit-role-submit" + > + <>
-
- - -
-
-
+ + )} {confirmRemoval && permissionsImpact && permissionsImpact.totalAffectedUsers > 0 && (