Skip to content

714/refactor-food-cards#743

Open
ShyamThangaraj wants to merge 1 commit into
devfrom
714/refactor-food-cards
Open

714/refactor-food-cards#743
ShyamThangaraj wants to merge 1 commit into
devfrom
714/refactor-food-cards

Conversation

@ShyamThangaraj
Copy link
Copy Markdown
Member

Summary

Refactors popular-dish-card.tsx and food-card.tsx to remove duplicated modal/mutation logic by extracting it into a new shared FoodCardShell component. Also adds dietary restriction/preference conflict indicators to popular dish cards on the home screen, which previously only showed on restaurant page cards.

Changes

  • food-card-shell.tsx (new) — shared wrapper that owns isDesktop, open/close state, logMealMutation, handleAddToMealTracker, and the Dialog/Drawer JSX. Uses a render prop (children) so each card passes in its own content while the shell handles the rest
  • food-card.tsx — removed all duplicated modal/mutation logic, now wraps FoodCardContent in FoodCardShell
  • popular-dish-card.tsx — same refactor as above; added getAllergies, getDietaryPreferences, and getDietaryConflicts so conflicting dishes now show a red warning icon and opacity-70 on the home screen

Testing Instructions

  • Go to /anteatery or /brandywine and click a food card — dialog (desktop) or drawer (mobile) should open as before
  • Add a dish to meal tracker from the dialog — snackbar should confirm
  • On the home screen, dishes that conflict with your dietary preferences should now show a red warning icon and reduced opacity
  • Check both light and dark mode look correct on both card types

Closes #714

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.

1 participant