Shravan: implement substitute ingredient modal with backend API integration#5167
Open
Shravan-neelamsetty wants to merge 1 commit intodevelopmentfrom
Open
Shravan: implement substitute ingredient modal with backend API integration#5167Shravan-neelamsetty wants to merge 1 commit intodevelopmentfrom
Shravan-neelamsetty wants to merge 1 commit intodevelopmentfrom
Conversation
✅ Deploy Preview for highestgoodnetwork-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Rajasrivatsansrinivasan
approved these changes
Apr 18, 2026
Rajasrivatsansrinivasan
left a comment
There was a problem hiding this comment.
Reviewed PR #5167 by Shravan. Checked out both the frontend and corresponding backend branch locally and tested the substitute ingredient flow on the recipes page. Verified that the recipes load correctly, substitution updates the ingredient in the UI, and changes persist after reopening the recipe. Confirmed the modal-based substitution flow works for other ingredients as expected. Functionality behaves as intended. Approving.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
Implements Phase 6 - Kitchen Inventory Management - Add functionality to substitute ingredient button. Also implement a backend endpoint to update the ingredient.
Implements the substitute ingredient modal that allows users to replace unavailable ingredients with available alternatives from the inventory. Clicking the "Substitute" button on any unavailable ingredient opens a popup with a searchable dropdown of available inventory items, a quantity input field, and confirm/cancel actions. On confirming, the ingredient is updated both in the UI and in the database via the backend API.
Related PRs (if any):
This frontend PR is related to the backend PR in the HGNRest repository on branch
shravan-substitute-ingredient-backend.This PR builds on top of PR #4996 (View Recipe Details) and PR #4879 (Recipes Landing Page).
Main changes explained:
SubstituteIngredientModal.jsxfor introducing the substitute ingredient popup component with searchable dropdown of inventory items (name, category, quantity available), quantity input, error handling, and API integrationSubstituteIngredientModal.module.cssfor all modal styling using CSS modules with earth-tone palette, dark mode support, responsive breakpoints, and error message displayViewRecipe.jsxfor tracking ingredients in local state, wiring the Substitute button to open the modal, handling confirmed substitutions via API response, and notifying the parent component of updatesRecipesLandingPage.jsxfor fetching recipes from the backend API instead of mock data, with fallback to mock data if API is unavailable, and handling recipe updates after substitutionRecipeCard.jsxfor supporting both MongoDB_idand mock dataidfieldsroutes.jsxfor adding the Recipes route with KIProtectedRouteHow to test:
shravan-substitute-ingredientnpm installandnpm run start:localto run this PR locallyshravan-substitute-ingredient-backendwithnpm start/kitchenandinventory/recipesScreenshots or videos of changes:
Light mode
Dark Mode
Before Substitution
After Substituition
Substituiton
Note:
The inventory dropdown currently uses mock inventory data. It will be updated to fetch from a real inventory endpoint once that collection is available. The backend endpoint
PUT /api/kitchenandinventory/recipes/:recipeId/substituteis fully functional and persists changes to MongoDB Atlas. If the backend is not running, the landing page falls back to mock data and substitutions update locally only. The Substitute and Reorder buttons only appear on ingredients whereisAvailableis false andisOnsiteis false. All styling uses CSS Modules as required by the project guidelines.