Skip to content

Admin Bugbash Fixes - #209

Open
Yurika-Kan wants to merge 27 commits into
mainfrom
yk/admin-bugbash
Open

Admin Bugbash Fixes#209
Yurika-Kan wants to merge 27 commits into
mainfrom
yk/admin-bugbash

Conversation

@Yurika-Kan

Copy link
Copy Markdown
Collaborator

📝 Description

  • Navbar clears the user only on unauthenticated, killing the load/refresh flicker; phone validation messages reworded.
  • Invalid ?donationId / ?orderId deep links show a "not found" error.
  • Donation Statistics totals fetch is independent of pagination, so "All Pantries" renders on every page.
  • Failed application fetches render an "Unable to Load Applications" error state.
  • Application Review "View Details" uses navigate() instead of href (SPA transition).
  • Cognito errors include the AWS reason and re-throw existing HttpExceptions.
  • Approve Food Manufacturers pagination arrows disable at first/last page.
  • Pantry assignee column checks for active volunteers before falling back to "No Volunteer".
  • User Management shows an "Admin" badge on admin rows.
  • Donation / Pantry / Manufacturer / Order Management show a "no results match filter" state.
  • Order Management table wrapped in overflowX="auto".
  • Removed dev-only "All Pages" nav link.
  • Donation details and delete modals hold the last donation in a ref while closing, fixing focus-trap errors.
  • Admin order table now refreshes auto after allocation edits.

Copilot AI lite review requested due to automatic review settings August 12, 2026 04:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread apps/frontend/src/components/forms/donationDetailsModal.tsx Outdated
Comment thread apps/frontend/src/containers/approvePantries.tsx
Comment thread apps/frontend/src/containers/approveFoodManufacturers.tsx
Comment thread apps/frontend/src/containers/adminPantryManagement.tsx Outdated
Comment thread apps/backend/src/pantries/dtos/update-pantry-application.dto.ts
Comment thread apps/backend/src/pantries/dtos/pantry-application.dto.ts

@dburkhart07 dburkhart07 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one other thing: is the test.ico actually needed here?

Comment thread apps/backend/src/auth/AUTH_AUDIT.md Outdated
Comment thread apps/backend/src/auth/dtos/sign-up.dto.ts Outdated
Comment thread apps/backend/src/pantries/dtos/pantry-application.dto.ts
Comment thread apps/frontend/src/components/Navbar.tsx
}
}, [setAlertMessage]);

useEffect(() => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes but i focused on admin pages

Comment thread apps/frontend/src/containers/adminPantryManagement.tsx Outdated
Comment thread apps/frontend/src/containers/approveFoodManufacturers.tsx Outdated
Comment thread apps/frontend/src/containers/userManagement.tsx
Prevents "Donation #undefined" header flash during modal close animation.
Yurika-Kan and others added 2 commits August 14, 2026 18:11
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>
Yurika-Kan and others added 3 commits August 14, 2026 18:19
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@Yurika-Kan
Yurika-Kan requested a review from dburkhart07 August 14, 2026 23:50

@dburkhart07 dburkhart07 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see a few slack questions in addition to this.

Comment thread apps/frontend/src/app.tsx
{
index: true,
element: <Homepage />,
element: <Navigate to={ROUTES.LOGIN} replace />,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread apps/frontend/src/app.tsx
{
path: ROUTES.UNAUTHORIZED,
element: <Unauthorized />,
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants