From 917cd987943d2a32d1c1e49591306f12d6e4d883 Mon Sep 17 00:00:00 2001 From: Heidi Jiang Date: Sun, 26 Jul 2026 21:45:30 -0400 Subject: [PATCH 1/3] focus trap errors for view order details --- .../src/containers/adminOrderManagement.tsx | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/apps/frontend/src/containers/adminOrderManagement.tsx b/apps/frontend/src/containers/adminOrderManagement.tsx index 21ddc3815..25940eaea 100644 --- a/apps/frontend/src/containers/adminOrderManagement.tsx +++ b/apps/frontend/src/containers/adminOrderManagement.tsx @@ -307,16 +307,14 @@ const AdminOrderManagement: React.FC = () => { ); })} - {selectedOrderId && ( - { - setSelectedOrderId(null); - navigate(ROUTES.ADMIN_ORDER_MANAGEMENT, { replace: true }); - }} - /> - )} + { + setSelectedOrderId(null); + navigate(ROUTES.ADMIN_ORDER_MANAGEMENT, { replace: true }); + }} + /> ); }; From b23d604c92e1813bd11951117fe0c86d73a31bf6 Mon Sep 17 00:00:00 2001 From: Heidi Jiang Date: Sun, 26 Jul 2026 21:55:01 -0400 Subject: [PATCH 2/3] focus trap errors for view donation details --- .../components/forms/donationDetailsModal.tsx | 240 +++++++++--------- .../frontend/src/containers/adminDonation.tsx | 22 +- 2 files changed, 133 insertions(+), 129 deletions(-) diff --git a/apps/frontend/src/components/forms/donationDetailsModal.tsx b/apps/frontend/src/components/forms/donationDetailsModal.tsx index 2561db55a..531883774 100644 --- a/apps/frontend/src/components/forms/donationDetailsModal.tsx +++ b/apps/frontend/src/components/forms/donationDetailsModal.tsx @@ -27,7 +27,7 @@ import EditableDonationItemsTable, { } from './editableDonationItemsTable'; interface DonationDetailsModalProps { - donation: Donation; + donation: Donation | null; isOpen: boolean; onClose: () => void; onSuccess: () => void; @@ -48,13 +48,14 @@ const DonationDetailsModal: React.FC = ({ const [isEditing, setIsEditing] = useState(false); - const donationId = donation.donationId; + const donationId = donation?.donationId; const handleCancel = () => { setIsEditing(false); }; const loadItems = useCallback(async () => { + if (donationId == null) return; try { const itemsData = await ApiClient.getDonationItemsByDonationId( donationId, @@ -66,6 +67,7 @@ const DonationDetailsModal: React.FC = ({ }, [donationId, setAlertMessage]); const handleUpdate = async (rows: DonationRow[]) => { + if (donationId == null) return; const existingIds = new Set(items.map((i) => i.itemId)); const body: ReplaceDonationItemDto[] = rows.map((r) => ({ ...(existingIds.has(r.id) ? { itemId: r.id } : {}), @@ -122,128 +124,132 @@ const DonationDetailsModal: React.FC = ({ )} - - - - - - - - - - - Donation #{donationId} Stock - - {donation.status === DonationStatus.AVAILABLE && ( - <> - setIsEditing(true)}> - - - )} - - - {donation.foodManufacturer?.foodManufacturerName} - - {formatDate(donation.dateDonated)} - - - - - {isEditing ? ( - ({ - id: item.itemId, - foodItem: item.itemName, - foodType: item.foodType, - numItems: String(item.quantity), - ozPerItem: String(item.ozPerItem), - valuePerItem: String(item.estimatedValue), - foodRescue: item.foodRescue, - }))} - onCancel={handleCancel} - onSubmit={handleUpdate} - submitButtonLabel="Update Donation" - > - ) : ( - - {Object.entries(groupedItems).map(([foodType, typeItems]) => ( - - - {foodType} - - - - {typeItems.map((item, _) => ( - - - {item.itemName} - + {donation !== null && ( + + + + + + + + + + + Donation #{donationId} Stock + + {donation.status === DonationStatus.AVAILABLE && ( + <> + setIsEditing(true)} + > + + + )} + + + {donation.foodManufacturer?.foodManufacturerName} + + {formatDate(donation.dateDonated)} + + + + {isEditing ? ( + ({ + id: item.itemId, + foodItem: item.itemName, + foodType: item.foodType, + numItems: String(item.quantity), + ozPerItem: String(item.ozPerItem), + valuePerItem: String(item.estimatedValue), + foodRescue: item.foodRescue, + }))} + onCancel={handleCancel} + onSubmit={handleUpdate} + submitButtonLabel="Update Donation" + > + ) : ( + + {Object.entries(groupedItems).map(([foodType, typeItems]) => ( + + + {foodType} + + + + {typeItems.map((item, _) => ( - - {item.quantity - item.reservedQuantity} of{' '} - {item.quantity} Remaining - + + {item.itemName} + + + + + {item.quantity - item.reservedQuantity} of{' '} + {item.quantity} Remaining + + - - ))} - - - ))} - - )} + ))} + + + ))} + + )} - {!isEditing && donation.recurrence !== RecurrenceEnum.NONE && ( - - - Donation sets up recurring reminders - + {!isEditing && donation.recurrence !== RecurrenceEnum.NONE && ( + + + Donation sets up recurring reminders + - {donation.nextDonationDates && - donation.nextDonationDates.length > 0 && ( - - - Upcoming reminder emails - - - {donation.nextDonationDates - .map((date) => formatDate(date)) - .join(', ')} - - - )} - - )} - - - + {donation.nextDonationDates && + donation.nextDonationDates.length > 0 && ( + + + Upcoming reminder emails + + + {donation.nextDonationDates + .map((date) => formatDate(date)) + .join(', ')} + + + )} + + )} + + + + )} ); }; diff --git a/apps/frontend/src/containers/adminDonation.tsx b/apps/frontend/src/containers/adminDonation.tsx index f1f488676..f1469c10e 100644 --- a/apps/frontend/src/containers/adminDonation.tsx +++ b/apps/frontend/src/containers/adminDonation.tsx @@ -341,18 +341,16 @@ const AdminDonation: React.FC = () => { }} /> - {selectedDonation && ( - { - setSelectedDonation(null); - navigate(ROUTES.ADMIN_DONATION, { replace: true }); - }} - onSuccess={() => fetchDonations()} - onDelete={() => setDeleteDonation(selectedDonation)} - /> - )} + { + setSelectedDonation(null); + navigate(ROUTES.ADMIN_DONATION, { replace: true }); + }} + onSuccess={() => fetchDonations()} + onDelete={() => setDeleteDonation(selectedDonation)} + /> {totalPages > 1 && ( Date: Sun, 26 Jul 2026 21:59:55 -0400 Subject: [PATCH 3/3] re-fetch users after adding a new user --- apps/frontend/src/containers/userManagement.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/frontend/src/containers/userManagement.tsx b/apps/frontend/src/containers/userManagement.tsx index 183ced43a..104df7eac 100644 --- a/apps/frontend/src/containers/userManagement.tsx +++ b/apps/frontend/src/containers/userManagement.tsx @@ -172,6 +172,7 @@ const VolunteerManagement: React.FC = () => { { setAlertMessage('User added.', AlertStatus.INFO); + fetchVolunteers(); }} onSubmitFail={() => { setAlertMessage('User could not be added.', AlertStatus.ERROR);