Skip to content

SSF-143 Reusable Order Details Modal #110

Open
Juwang110 wants to merge 14 commits intomainfrom
jw/SSF-143-reusable-order-details-modal
Open

SSF-143 Reusable Order Details Modal #110
Juwang110 wants to merge 14 commits intomainfrom
jw/SSF-143-reusable-order-details-modal

Conversation

@Juwang110
Copy link

ℹ️ Issue

Closes https://vidushimisra.atlassian.net/jira/software/projects/SSF/boards/1?selectedIssue=SSF-143

📝 Description

This simple PR involves changes to make a reusable order details modal component that displays details of an order and the associated request. This modal is used by Admin, Volunteer, Pantry so this component will be used in many places.

The order details modal was updated on this existing page: /admin-order-management

✔️ Verification

I added a new route to get order details given an orderId so I added controller and service tests for that. I also verified the modal aligned with the figma designs.

Screenshot 2026-02-16 164606 Screenshot 2026-02-16 164603

🏕️ (Optional) Future Work / Notes

N/A

@Juwang110 Juwang110 requested a review from amywng February 23, 2026 16:46
</Text>
{orderDetails?.trackingLink ? (
<Link
href={orderDetails.trackingLink}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Noting for me and @Yurika-Kan that the way things are currently set up, this creates a security vulnerability where (although at least the text of the link is shown so it's more obvious that it's not a normal link), a food manufacturer could provide a tracking link like javascript:alert("you've been hacked!") and then clicking here actually executes that javascript (I tried it and it is funny but also a problem). Justin, not expecting you to fix this here - backend link sanitization may be the way to go - but wanted to make sure everyone was aware

@Juwang110 Juwang110 requested a review from sam-schu February 23, 2026 23:49

export type RepeatOnState = Record<DayOfWeek, boolean>;

export type GroupedByFoodType = Record<
Copy link
Collaborator

Choose a reason for hiding this comment

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

I noticed that this type is based on the FoodTypes array, which is just a list of all the values of the FoodType enum. While we're here, can we remove FoodTypes and refactor its usages to use the values of FoodType instead, as we do for our other enums in the frontend? (This case here in particular could probably actually map enum keys to OrderItemDetails[] instead.)

Copy link
Member

Choose a reason for hiding this comment

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

i did this in this pr, so if you want to review that to see if i missed anything but i don't think it needs to be done here


export type RepeatOnState = Record<DayOfWeek, boolean>;

export type GroupedByFoodType = Record<
Copy link
Collaborator

Choose a reason for hiding this comment

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

Record implies that all food types exist in the map, which isn't true. This should probably be a Partial<Record>, which should hopefully also avoid needing the casts in groupedItemsByType

Copy link
Member

Choose a reason for hiding this comment

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

also done in this pr

@Juwang110 Juwang110 requested review from amywng and sam-schu February 27, 2026 02:24
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.

3 participants