From 6d18839589c2db179f2ebfd4e6463d1faa497801 Mon Sep 17 00:00:00 2001 From: Paul R Kartchner Date: Sat, 1 Nov 2025 05:09:09 +0000 Subject: [PATCH] feat: unified recipe editing interface with integrated ingredient mapping MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Major Features ### Unified Edit Interface - Created new UnifiedEditRecipe component combining recipe editing and ingredient-instruction mapping - Two-column layout: sticky ingredients panel (left) + instructions with drop zones (right) - Eliminated need to switch between separate edit and mapping pages ### Ingredient Management - Multi-select checkboxes for bulk operations - Inline editing of ingredient amounts, units, and names - Drag-and-drop ingredients to instruction steps - Bulk mapping: select multiple ingredients and assign to a step - Delete selected ingredients in bulk - Sticky ingredient panel with improved scrolling ### Instruction Editing - Click-to-edit inline editing for instruction text and timing - Edit/Delete buttons on each instruction step - Visual drop zones that highlight when dragging ingredients - Shows mapped ingredients directly in each step with remove buttons - Add new instructions with + button ### UI/UX Improvements - Collapsible recipe details section (compact layout) - 50/50 column split for balanced view - Sticky footer with Save/Cancel buttons - Compact, professional styling from mapping interface - Smaller image preview (200px) - Improved form spacing and padding - Fixed scrolling issues in ingredient panel ### Save Logic Enhancements - Improved ID matching algorithm using position and content - Handles newly added ingredients and instructions correctly - Matches by index position to handle duplicates better - Two-step fallback matching (index + content, then exact content) - Better error handling and logging ### Route Changes - Updated /recipes/:id/edit to use UnifiedEditRecipe - Removed /recipes/:id/manage-mappings route (no longer needed) - Updated Cooking Mode button: "Manage Ingredients" → "Edit Recipe" ## Technical Details - New Files: - packages/web/src/pages/UnifiedEditRecipe.tsx (~1000 lines) - packages/web/src/styles/UnifiedRecipeEdit.css (~850 lines) - Modified Files: - packages/web/src/App.tsx (removed old mapping route) - packages/web/src/pages/CookingMode.tsx (updated button) - Technologies: React, TypeScript, CSS Grid, Flexbox, Drag & Drop API 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- packages/web/src/App.tsx | 6 +- packages/web/src/pages/CookingMode.tsx | 4 +- packages/web/src/pages/UnifiedEditRecipe.tsx | 1101 +++++++++++++++++ packages/web/src/styles/UnifiedRecipeEdit.css | 861 +++++++++++++ 4 files changed, 1966 insertions(+), 6 deletions(-) create mode 100644 packages/web/src/pages/UnifiedEditRecipe.tsx create mode 100644 packages/web/src/styles/UnifiedRecipeEdit.css diff --git a/packages/web/src/App.tsx b/packages/web/src/App.tsx index 3cf8728..c1dbc1f 100644 --- a/packages/web/src/App.tsx +++ b/packages/web/src/App.tsx @@ -3,9 +3,8 @@ import RecipeList from './pages/RecipeList'; import RecipeDetail from './pages/RecipeDetail'; import RecipeImport from './pages/RecipeImport'; import NewRecipe from './pages/NewRecipe'; -import EditRecipe from './pages/EditRecipe'; +import UnifiedEditRecipe from './pages/UnifiedEditRecipe'; import CookingMode from './pages/CookingMode'; -import ManageIngredientMappings from './pages/ManageIngredientMappings'; import './App.css'; function App() { @@ -28,9 +27,8 @@ function App() { } /> } /> - } /> + } /> } /> - } /> } /> } /> diff --git a/packages/web/src/pages/CookingMode.tsx b/packages/web/src/pages/CookingMode.tsx index 004b8e1..df06c3c 100644 --- a/packages/web/src/pages/CookingMode.tsx +++ b/packages/web/src/pages/CookingMode.tsx @@ -219,8 +219,8 @@ function CookingMode() { Show ingredients with steps - + + ); + } + + const allIngredients = getAllIngredients(); + const allInstructions = getAllInstructions(); + + return ( +
+ {/* Header */} +
+
+

Edit Recipe

+

{title || 'Untitled Recipe'}

+
+ +
+ + + + + +
+
+ + {/* Unsaved changes banner */} + {hasChanges && ( +
+ ⚠️ You have unsaved changes. Click "Save All Changes" to persist them. +
+ )} + + {/* Collapsible Basic Info Section */} +
+
setBasicInfoCollapsed(!basicInfoCollapsed)} + > +

Recipe Details

+ + ▼ + +
+ + {!basicInfoCollapsed && ( +
+
+ + { + setTitle(e.target.value); + setHasChanges(true); + }} + required + /> +
+ +
+ +