From eb1c798b70033767dd4309fa7b0929a0a337fabc Mon Sep 17 00:00:00 2001 From: Michael Genson <71845777+michael-genson@users.noreply.github.com> Date: Fri, 11 Jul 2025 21:32:16 +0000 Subject: [PATCH] restore hiding scale edit if nothing is parsed --- .../RecipePage/RecipePageParts/RecipePageScale.vue | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/frontend/components/Domain/Recipe/RecipePage/RecipePageParts/RecipePageScale.vue b/frontend/components/Domain/Recipe/RecipePage/RecipePageParts/RecipePageScale.vue index 9fd57e52b..c8b89589b 100644 --- a/frontend/components/Domain/Recipe/RecipePage/RecipePageParts/RecipePageScale.vue +++ b/frontend/components/Domain/Recipe/RecipePage/RecipePageParts/RecipePageScale.vue @@ -4,7 +4,7 @@ v-if="!isEditMode" v-model.number="scaleValue" :recipe-servings="recipeServings" - :edit-scale="!isEditMode" + :edit-scale="hasFoodOrUnit && !isEditMode" /> @@ -37,6 +37,17 @@ export default defineNuxtComponent({ return props.recipe.recipeServings || props.recipe.recipeYieldQuantity || 1; }); + const hasFoodOrUnit = computed(() => { + if (props.recipe.recipeIngredient) { + for (const ingredient of props.recipe.recipeIngredient) { + if (ingredient.food || ingredient.unit) { + return true; + } + } + } + return false; + }); + const scaleValue = computed({ get() { return props.scale; @@ -50,6 +61,7 @@ export default defineNuxtComponent({ recipeServings, scaleValue, isEditMode, + hasFoodOrUnit, }; }, });