Conversation
# Conflicts: # SparkyFitnessMobile/App.tsx # SparkyFitnessMobile/src/hooks/index.ts # SparkyFitnessMobile/src/screens/FoodEntryAddScreen.tsx # SparkyFitnessMobile/src/screens/FoodFormScreen.tsx # SparkyFitnessMobile/src/types/navigation.ts
… and save food logic - Added support for meal builder mode in FoodFormScreen, allowing users to save food entries as meal ingredients. - Introduced a new utility function to build meal ingredient drafts from saved food. - Updated the FoodSearchScreen to improve accessibility and UI consistency. - Enhanced MealBuilderScreen layout and integrated nutrition macro display. - Created a new utility file for meal builder draft functions.
# Conflicts: # SparkyFitnessMobile/src/screens/FoodEntryAddScreen.tsx # SparkyFitnessMobile/src/screens/FoodFormScreen.tsx
There was a problem hiding this comment.
Code Review
This pull request introduces a Meal Builder feature, enabling users to create and save custom meals by combining multiple food ingredients. The implementation includes a new MealBuilderScreen, a useCreateMeal hook, and a NutritionMacroCard component for shared macro visualization. Existing screens for food searching, adding, and scanning were updated with a 'meal-builder' mode to facilitate ingredient selection. Feedback was provided regarding the error handling in FoodEntryAddScreen, where failures during the saving of external foods could result in silent errors.
apedley
left a comment
There was a problem hiding this comment.
Need some tests here. Here's what I'd focus on:
mealbuilderscreen.tsx - mainly handleSaveMeal validation
foodentryaddscreen.tsx - all the additions
foodformscreen.tsx - all the additions
There's also some easy pure unit tests to be written in mealBuilderDraft.ts
The rest is mostly cosmetic so don't worry about testing that stuff.
…l builder draft utilities - Created FoodFormScreen.test.tsx to test the FoodFormScreen component, including saving food, logging, and validation. - Created MealBuilderScreen.test.tsx to test the MealBuilderScreen component, focusing on meal creation, ingredient management, and error handling. - Added mealBuilderDraft.test.ts to test utility functions for building meal ingredient drafts. - Refactored MealBuilderScreen to remove BottomSheetModalProvider and streamline the layout. - Updated MealBuilderScreen to improve ingredient handling and UI responsiveness.
These have been added. |
Tip
Help us review and merge your PR faster!
Please ensure you have completed the Checklist below.
For Frontend changes, please run
pnpm run validateto check for any errors.PRs that include tests and clear screenshots are highly preferred!
Note: AI-generated descriptions must be manually edited for conciseness. Do not paste raw AI summaries.
Description
What problem does this PR solve?
Allows users to create meals in the app just like they can on the web.
How did you implement the solution?
I added the existing food pickers into a
meal-buildermode, and reused the existing backend meal-create endpoint so foods can be added and saved directly from the app.Linked Issue: #
How to Test
PR Type
Checklist
All PRs:
New features only:
Frontend changes (
SparkyFitnessFrontend/orsrc/):pnpm run validateand it passes.en) translation file.Backend changes (
SparkyFitnessServer/):rls_policies.sqlfor any new user-specific tables.UI changes (components, screens, pages):
Screenshots
Click to expand
Before
After
Notes for Reviewers