fix(ui,auth): modals dim instead of blanking + role parser covers all variants #95

Merged
YousifShkara merged 1 commit from fix/modal-overlay-and-billing-perm into main 2026-06-09 07:39:12 +02:00
Owner

Two unrelated SPA bugs that surfaced together while triaging mokosh:

  1. Add Note / Add Task / New Appointment / Schedule Appointment (every modal that uses components::Modal or components::SlideOver) rendered the page fully black behind the dialog instead of a 75% gray dim. The Tailwind v4 upgrade removed bg-opacity-*; the existing classes resolved to bg-gray-500 with no alpha, so the backdrop was opaque gray over the whole viewport. Switching to the v4 slash-alpha syntax (bg-gray-500/75) restores the dim. Same fix applied to the mobile sidebar backdrop and the LoadingOverlay in components::layout so nothing else regresses behind the same removal.

  2. hooks::auth::rehydrate_from_storage and refresh_user_from_me matched the role string against "admin" | "manager" | "finance" only. Any other server-returned role (super_admin / technician / dispatcher / sales) fell through to the catch-all and the user was silently coerced to the Technician default. Super_admin users hit it the hardest: they have full server-side permissions but the SPA saw them as Technician and denied billing / invoices / payments with "You do not have permission to access billing pages". Both sites now delegate to UserRole::from_str which already enumerates every variant, so all seven roles round-trip cleanly.

Note on the billing page itself: a Technician seeing the no-permission card IS the intended behaviour - the gate is UserRole::can_manage_billing which matches SuperAdmin / Admin / Finance only. The bug was the parser silently downgrading non-Technicians, not the gate.

Two unrelated SPA bugs that surfaced together while triaging mokosh: 1) Add Note / Add Task / New Appointment / Schedule Appointment (every modal that uses `components::Modal` or `components::SlideOver`) rendered the page fully black behind the dialog instead of a 75% gray dim. The Tailwind v4 upgrade removed `bg-opacity-*`; the existing classes resolved to `bg-gray-500` with no alpha, so the backdrop was opaque gray over the whole viewport. Switching to the v4 slash-alpha syntax (`bg-gray-500/75`) restores the dim. Same fix applied to the mobile sidebar backdrop and the LoadingOverlay in `components::layout` so nothing else regresses behind the same removal. 2) `hooks::auth::rehydrate_from_storage` and `refresh_user_from_me` matched the role string against `"admin" | "manager" | "finance"` only. Any other server-returned role (super_admin / technician / dispatcher / sales) fell through to the catch-all and the user was silently coerced to the Technician default. Super_admin users hit it the hardest: they have full server-side permissions but the SPA saw them as Technician and denied billing / invoices / payments with "You do not have permission to access billing pages". Both sites now delegate to `UserRole::from_str` which already enumerates every variant, so all seven roles round-trip cleanly. Note on the billing page itself: a Technician seeing the no-permission card IS the intended behaviour - the gate is `UserRole::can_manage_billing` which matches SuperAdmin / Admin / Finance only. The bug was the parser silently downgrading non-Technicians, not the gate.
fix(ui,auth): modals dim instead of blanking + role parser covers all variants
All checks were successful
Create release / Create release from merged PR (pull_request) Has been skipped
Check / clippy + fmt + tests (pull_request) Successful in 2m36s
7aef060286
Two unrelated SPA bugs that surfaced together while triaging mokosh:

1) Add Note / Add Task / New Appointment / Schedule Appointment (every modal that uses `components::Modal` or `components::SlideOver`) rendered the page fully black behind the dialog instead of a 75% gray dim. The Tailwind v4 upgrade removed `bg-opacity-*`; the existing classes resolved to `bg-gray-500` with no alpha, so the backdrop was opaque gray over the whole viewport. Switching to the v4 slash-alpha syntax (`bg-gray-500/75`) restores the dim. Same fix applied to the mobile sidebar backdrop and the LoadingOverlay in `components::layout` so nothing else regresses behind the same removal.

2) `hooks::auth::rehydrate_from_storage` and `refresh_user_from_me` matched the role string against `"admin" | "manager" | "finance"` only. Any other server-returned role (super_admin / technician / dispatcher / sales) fell through to the catch-all and the user was silently coerced to the Technician default. Super_admin users hit it the hardest: they have full server-side permissions but the SPA saw them as Technician and denied billing / invoices / payments with "You do not have permission to access billing pages". Both sites now delegate to `UserRole::from_str` which already enumerates every variant, so all seven roles round-trip cleanly.

Note on the billing page itself: a Technician seeing the no-permission card IS the intended behaviour - the gate is `UserRole::can_manage_billing` which matches SuperAdmin / Admin / Finance only. The bug was the parser silently downgrading non-Technicians, not the gate.
YousifShkara deleted branch fix/modal-overlay-and-billing-perm 2026-06-09 07:39:12 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
psa-systems/mokosh-apps!95
No description provided.