Admin Bugbash Fixes - #209
Conversation
There was a problem hiding this comment.
Pull request overview
This PR bundles a set of admin-facing UI/UX bug fixes across the frontend (empty/error states, pagination behavior, SPA navigation, table overflow, and modal stability) plus backend improvements to validation messages and Cognito error propagation, along with an auth endpoint audit document.
Changes:
- Improve admin list pages: add “no matching results” / error states, fix pagination behaviors, and enhance navigation/labels.
- Stabilize donation modals during close (avoid focus-trap/body-lock issues) and refresh admin orders after allocation edits.
- Update backend phone validation messages and include underlying Cognito/AWS failure reasons in auth errors; add backend auth posture audit doc.
Reviewed changes
Copilot reviewed 19 out of 21 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/frontend/src/containers/userManagement.tsx | Adds an “Admin” badge for admin rows in the volunteer table. |
| apps/frontend/src/containers/approvePantries.tsx | Adds fetch error state UI and switches “View Details” to SPA navigation. |
| apps/frontend/src/containers/approveFoodManufacturers.tsx | Adds fetch error UI, “no matching applications” empty state, SPA navigation, and disables pagination arrows at bounds. |
| apps/frontend/src/containers/adminPantryManagement.tsx | Adds “no pantries / no matching pantries” empty state and refines assignee display to only consider active volunteers. |
| apps/frontend/src/containers/adminOrderManagement.tsx | Refactors order fetch into a reusable callback, adds deep-link “not found” error, refreshes after edits, and adds horizontal overflow for the table. |
| apps/frontend/src/containers/adminDonationStats.tsx | Fetches total stats independent of pagination so “All Pantries” totals render on every page. |
| apps/frontend/src/containers/adminDonation.tsx | Adds deep-link “donation not found” error, adds filtered empty state, and renders details modal in a way that supports stable closing. |
| apps/frontend/src/components/Navbar.tsx | Avoids clearing current user during non-unauthenticated transitions; removes dev-only nav link; adjusts label text. |
| apps/frontend/src/components/forms/fmDeleteDonationModal.tsx | Holds the last donation in a ref during close to prevent modal lock/focus issues. |
| apps/frontend/src/components/forms/donationDetailsModal.tsx | Holds the last donation in a ref during close; updates header/details rendering accordingly. |
| apps/backend/src/users/dtos/userSchema.dto.ts | Updates phone validation message wording. |
| apps/backend/src/users/dtos/update-user-info.dto.ts | Updates phone validation message wording. |
| apps/backend/src/pantries/dtos/update-pantry-application.dto.ts | Updates secondary contact phone validation message wording. |
| apps/backend/src/pantries/dtos/pantry-application.dto.ts | Updates phone and secondary contact phone validation message wording. |
| apps/backend/src/foodManufacturers/dtos/update-manufacturer-application.dto.ts | Updates secondary contact phone validation message wording. |
| apps/backend/src/foodManufacturers/dtos/manufacturer-application.dto.ts | Updates phone and secondary contact phone validation message wording. |
| apps/backend/src/auth/dtos/sign-up.dto.ts | Updates phone validation message wording. |
| apps/backend/src/auth/auth.service.ts | Re-throws existing HttpExceptions and appends underlying error “reason” to internal server errors. |
| apps/backend/src/auth/AUTH_AUDIT.md | Adds a living inventory of backend routes and their auth/guard posture. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
dburkhart07
left a comment
There was a problem hiding this comment.
one other thing: is the test.ico actually needed here?
Prevents "Donation #undefined" header flash during modal close animation.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Yurika-Kan <148014074+Yurika-Kan@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
dburkhart07
left a comment
There was a problem hiding this comment.
see a few slack questions in addition to this.
| { | ||
| index: true, | ||
| element: <Homepage />, | ||
| element: <Navigate to={ROUTES.LOGIN} replace />, |
There was a problem hiding this comment.
We now have an issue that, if the user is already logged in, and is supposed to be brought straight to the profile page (one that depends entirely on backend data, unlike the homepage we used to have), itll take 30 seconds for the backend to startup before the user can actually see details on it (right now it just says No Profile Found until then). Im not sure if there is a workaround for this (or maybe its not a big deal since in theory the backend will be permanently running when its in production), but wanted to ask.
| @@ -35,8 +35,10 @@ const NewVolunteerModal: React.FC<NewVolunteerModalProps> = ({ | |||
| const [isOpen, setIsOpen] = useState(false); | |||
There was a problem hiding this comment.
Found a new bug, where the alert state gets stale.
To reproduce:
- Open the "Add New User" modal.
- Enter a faulty name/email/phone number.
- Close the modal.
- Open the modal again, and the error message appears without filling in any fields.
Drops password/phone (never used by admin-created users) and adds role directly to the DTO instead of an ad-hoc Omit<> intersection type.
…n cold backend Previously a single failed getMe() call (e.g. backend still starting up) permanently showed "Profile not found", with no recovery short of a manual refresh. Now retries every 3s while the backend is unreachable (no HTTP response), only giving up on a real auth error response.
Closing via backdrop click or the X button left isEditing stuck true, so reopening the modal showed the edit form instead of the details view. Only the Cancel button reset it before. Now onOpenChange resets isEditing whenever the dialog closes, matching Cancel's behavior.
Requested in review for readability now that public/protected routes are interleaved without the old homepage route as a visual anchor.
Standardizes filter UX by adding search-to-filter inputs to adminDonation, approveFoodManufacturers, and approvePantries, matching the existing pattern in pantry/manufacturer management pages.
…ntity Backend rejects edit/delete once a donation has reserved items even while status is still AVAILABLE; mirror that in the details modal. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 43 out of 44 changed files in this pull request and generated 3 comments.
Suppressed comments (1)
apps/backend/src/foodManufacturers/dtos/update-manufacturer-application.dto.ts:41
- The updated validation copy here uses "Secondary phone contact…", but other updated DTOs in this PR use the shorter "Secondary phone…" phrasing. For consistency (and clearer UX), align this message with the others (e.g., "Secondary phone must be a valid US phone number.").
@IsOptional()
@IsString()
@IsPhoneNumber('US', {
message: 'Secondary phone contact must be a valid US phone number.',
})
| <OrderDetailsModal | ||
| orderId={selectedOrderId} | ||
| isOpen={selectedOrderId !== null} | ||
| onClose={() => { | ||
| setSelectedOrderId(null); | ||
| navigate(ROUTES.ADMIN_ORDER_MANAGEMENT, { replace: true }); | ||
| }} | ||
| onSuccess={fetchOrders} | ||
| /> |
Alert state persisted across modal reopens since only isOpen was reset. clearAlert now runs on every close path (X, Cancel, backdrop, success/fail).
Long badge labels (e.g. "Food Manufacturer") could overflow past the card's right edge on narrow cards since the header row never wrapped.
… disappears selectedManufacturers never got reconciled against manufacturerOptions after a refetch, so deleting a manufacturer's last donation left its name stuck in the filter state with no visible checkbox to uncheck it, permanently showing "No donations match the selected filter." Also reset the filter's search text on close so it doesn't show a stale query with no results. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
…ut safely Address Copilot review comments: fetchOrders was resetting currentPages to 1 on every call, bouncing admin back to page 1 after saving edits in the order details modal. Also type retryTimeout as possibly undefined to match how it's actually assigned.
The accepted Copilot autofix (cc953a8) left the closing tag missing its '>', a JSX syntax error that would fail the build.
jiang-h-y
left a comment
There was a problem hiding this comment.
lgtm! tested that the bugs we surfaced can no longer be reproduced
📝 Description
unauthenticated, killing the load/refresh flicker; phone validation messages reworded.?donationId/?orderIddeep links show a "not found" error.navigate()instead ofhref(SPA transition).HttpExceptions.overflowX="auto".