From b43b45dac25cadd566fcb7ccdfc31a7651ac4355 Mon Sep 17 00:00:00 2001 From: Alexander Bocken Date: Tue, 13 Jan 2026 19:08:24 +0100 Subject: [PATCH] feat: add base multiplier support for recipe references Add optional baseMultiplier field to ingredient and instruction references, allowing base recipes to be included at scaled amounts (e.g., 0.5 for half the recipe). - Add baseMultiplier field to Recipe schema with default value of 1 - Update TypeScript types to include baseMultiplier - Add multiplier input field to BaseRecipeSelector modal - Apply baseMultiplier to ingredient amounts during flattening - Combine baseMultiplier with recipe multiplier in links - Display and allow editing baseMultiplier in recipe editor The multiplier cascades through nested references and works alongside the standard recipe multiplier for compound scaling. --- src/lib/components/BaseRecipeSelector.svelte | 23 +++++++-- .../components/CreateIngredientList.svelte | 13 +++++ src/lib/components/CreateStepList.svelte | 13 +++++ src/lib/components/IngredientsPage.svelte | 48 +++++++++++++++---- src/lib/components/InstructionsPage.svelte | 7 ++- src/models/Recipe.ts | 4 ++ src/types/types.ts | 2 + 7 files changed, 95 insertions(+), 15 deletions(-) diff --git a/src/lib/components/BaseRecipeSelector.svelte b/src/lib/components/BaseRecipeSelector.svelte index b412ee4..60ce1f5 100644 --- a/src/lib/components/BaseRecipeSelector.svelte +++ b/src/lib/components/BaseRecipeSelector.svelte @@ -23,7 +23,8 @@ let options = $state({ includeIngredients: false, includeInstructions: false, showLabel: true, - labelOverride: '' + labelOverride: '', + baseMultiplier: 1 }); // Reset options whenever type or modal state changes @@ -46,6 +47,7 @@ function handleInsert() { selectedRecipe = null; options.labelOverride = ''; options.showLabel = true; + options.baseMultiplier = 1; closeModal(); } } @@ -134,7 +136,8 @@ dialog h2 { } .selector-content select, -.selector-content input[type="text"] { +.selector-content input[type="text"], +.selector-content input[type="number"] { width: 100%; padding: 0.5em 1em; margin-top: 0.5em; @@ -149,7 +152,9 @@ dialog h2 { .selector-content select:hover, .selector-content select:focus, .selector-content input[type="text"]:hover, -.selector-content input[type="text"]:focus { +.selector-content input[type="text"]:focus, +.selector-content input[type="number"]:hover, +.selector-content input[type="number"]:focus { border-color: var(--nord9); transform: scale(1.02, 1.02); } @@ -245,6 +250,18 @@ dialog h2 { {/if} + +
📋 {t[lang].baseRecipe}: {list.name || t[lang].unnamed} +
+ +
📋 {t[lang].baseRecipe}: {list.name || t[lang].unnamed} +
+ +