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.
This commit is contained in:
@@ -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 {
|
||||
</label>
|
||||
{/if}
|
||||
|
||||
<label>
|
||||
Mengenfaktor (Multiplikator):
|
||||
<input
|
||||
type="number"
|
||||
bind:value={options.baseMultiplier}
|
||||
min="0.1"
|
||||
step="0.1"
|
||||
placeholder="1"
|
||||
onkeydown={(event) => do_on_key(event, 'Enter', false, handleInsert)}
|
||||
/>
|
||||
</label>
|
||||
|
||||
<div class="button-group">
|
||||
<button class="button-insert" onclick={handleInsert} disabled={!selectedRecipe}>
|
||||
Einfügen
|
||||
|
||||
Reference in New Issue
Block a user