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?
| } | ||
| }, [setAlertMessage]); | ||
|
|
||
| useEffect(() => { |
There was a problem hiding this comment.
Was this a dependency issue and thats why it needed to be a callback? I thought we have a lot of these dependency issues throughout the code. Why are we just cleaning up this one?
There was a problem hiding this comment.
yes but i focused on admin pages
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.
| { | ||
| path: ROUTES.UNAUTHORIZED, | ||
| element: <Unauthorized />, | ||
| }, |
There was a problem hiding this comment.
Should add a comment that this is where the protected routes start.
| @@ -1,3 +1,3 @@ | |||
| import { IsEmail, IsNotEmpty, IsString, IsPhoneNumber } from 'class-validator'; | |||
|
|
|||
| export class SignUpDto { | |||
There was a problem hiding this comment.
This whole dto is only used in one spot (the adminCreateUser function). Lets change the dto to not have a password or phone, and add in the role enum into the dto, and we can just change the type it takes in to actually be the dto, as well as construct it as such in the create user service function.
| @@ -1,4 +1,4 @@ | |||
| import React, { useState, useEffect, useCallback } from 'react'; | |||
| import React, { useState, useEffect, useCallback, useRef } from 'react'; | |||
There was a problem hiding this comment.
New bug found on this page (and its integration with the adminDonation): When we click on the edit button, the edit state persists if we click out of the modal or click on the 'x' at the top left. the only thing that clears it is the the cancel button. isEditing should go away whenever the modal gets unmounted/isOpen is made false. This seems to only be an issue with the donation details modal with the admin donation page, so likely an issue specifically in there.
📝 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".