From 05cfb98cebc93ffe28990dc6f2a2376536ea4aa8 Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Mon, 30 Nov 2026 12:48:42 +0000 Subject: [PATCH] feat(recipe): add step quantities and appliance settings --- .../Domain/Recipe/RecipeIngredientHtml.vue | 5 +- .../Recipe/RecipeIngredientListItem.vue | 4 +- .../Domain/Recipe/RecipeIngredients.test.ts | 13 ++++ .../Domain/Recipe/RecipeIngredients.vue | 18 ++++- .../Domain/Recipe/RecipePage/RecipePage.vue | 8 +- .../RecipePageInstructions.test.ts | 68 ++++++++++++++++ .../RecipePageInstructions.vue | 58 ++++++++++++-- .../Domain/Recipe/RecipePrintContainer.vue | 4 +- .../Domain/Recipe/RecipePrintView.test.ts | 42 ++++++++++ .../Domain/Recipe/RecipePrintView.vue | 25 ++++-- .../Domain/Recipe/RecipeStepCooking.test.ts | 35 +++++++++ .../Domain/Recipe/RecipeStepCooking.vue | 78 +++++++++++++++++++ .../__tests__/use-recipe-ingredients.test.ts | 16 +++- .../recipes/use-recipe-ingredients.ts | 11 ++- frontend/app/lang/messages/en-US.json | 11 +++ frontend/app/lib/api/types/household.ts | 8 ++ frontend/app/lib/api/types/recipe.ts | 8 ++ .../app/lib/recipe/instruction-merge.test.ts | 27 ++++++- frontend/app/lib/recipe/instruction-merge.ts | 35 ++++++++- .../app/lib/recipe/step-ingredients.test.ts | 19 +++++ frontend/app/lib/recipe/step-ingredients.ts | 25 ++++++ ...42c6d50a10_add_step_ingredient_quantity.py | 23 ++++++ ...-00.00.01_c981d7e62b11_add_step_cooking.py | 23 ++++++ mealie/db/models/recipe/instruction.py | 4 +- mealie/schema/recipe/__init__.py | 3 +- mealie/schema/recipe/recipe_step.py | 15 +++- .../steps/enrich_instructions.py | 7 +- mealie/services/recipe/recipe_service.py | 21 +++-- .../test_recipe_create_from_mealie_export.py | 62 ++++++++++++++- .../test_enrich_instructions.py | 22 +++++- tests/unit_tests/test_step_cooking_schema.py | 33 ++++++++ .../test_step_metadata_migrations.py | 50 ++++++++++++ 32 files changed, 735 insertions(+), 46 deletions(-) create mode 100644 frontend/app/components/Domain/Recipe/RecipePage/RecipePageParts/RecipePageInstructions.test.ts create mode 100644 frontend/app/components/Domain/Recipe/RecipePrintView.test.ts create mode 100644 frontend/app/components/Domain/Recipe/RecipeStepCooking.test.ts create mode 100644 frontend/app/components/Domain/Recipe/RecipeStepCooking.vue create mode 100644 frontend/app/lib/recipe/step-ingredients.test.ts create mode 100644 frontend/app/lib/recipe/step-ingredients.ts create mode 100644 mealie/alembic/versions/2026-11-30-00.00.00_b742c6d50a10_add_step_ingredient_quantity.py create mode 100644 mealie/alembic/versions/2026-11-30-00.00.01_c981d7e62b11_add_step_cooking.py create mode 100644 tests/unit_tests/test_step_cooking_schema.py create mode 100644 tests/unit_tests/test_step_metadata_migrations.py diff --git a/frontend/app/components/Domain/Recipe/RecipeIngredientHtml.vue b/frontend/app/components/Domain/Recipe/RecipeIngredientHtml.vue index e89c08240..6c5d7f24d 100644 --- a/frontend/app/components/Domain/Recipe/RecipeIngredientHtml.vue +++ b/frontend/app/components/Domain/Recipe/RecipeIngredientHtml.vue @@ -17,14 +17,15 @@ import { useIngredientTextParser } from "~/composables/recipes"; interface Props { ingredient?: RecipeIngredient; scale?: number; + showZero?: boolean; } -const { ingredient, scale = 1 } = defineProps(); +const { ingredient, scale = 1, showZero = false } = defineProps(); const { useParsedIngredientText } = useIngredientTextParser(); const baseText = computed(() => { if (!ingredient) return ""; - const parsed = useParsedIngredientText(ingredient, scale); + const parsed = useParsedIngredientText(ingredient, scale, true, undefined, showZero); return [parsed.quantity, parsed.unit, parsed.name].filter(Boolean).join(" ").trim(); }); diff --git a/frontend/app/components/Domain/Recipe/RecipeIngredientListItem.vue b/frontend/app/components/Domain/Recipe/RecipeIngredientListItem.vue index f5773e053..76296b62e 100644 --- a/frontend/app/components/Domain/Recipe/RecipeIngredientListItem.vue +++ b/frontend/app/components/Domain/Recipe/RecipeIngredientListItem.vue @@ -45,10 +45,12 @@ interface Props { // off by default: the shopping list and the add-to-list dialog reuse this row, and a menu // button is noise in both. the recipe renderer opts in showSubstitutions?: boolean; + showZero?: boolean; } const props = withDefaults(defineProps(), { scale: 1, showSubstitutions: false, + showZero: false, }); const route = useRoute(); const auth = useMealieAuth(); @@ -56,7 +58,7 @@ const groupSlug = computed(() => route.params.groupSlug || auth.user?.value?.gro const { useParsedIngredientText } = useIngredientTextParser(); const parsedIng = computed(() => { - return useParsedIngredientText(props.ingredient, props.scale, true, groupSlug.value.toString()); + return useParsedIngredientText(props.ingredient, props.scale, true, groupSlug.value.toString(), props.showZero); }); diff --git a/frontend/app/components/Domain/Recipe/RecipeIngredients.test.ts b/frontend/app/components/Domain/Recipe/RecipeIngredients.test.ts index af9f734b4..0802e3299 100644 --- a/frontend/app/components/Domain/Recipe/RecipeIngredients.test.ts +++ b/frontend/app/components/Domain/Recipe/RecipeIngredients.test.ts @@ -98,4 +98,17 @@ describe("RecipeIngredients", () => { const labels = wrapper.findAll("input[type='checkbox']").map(input => input.attributes("aria-label")); expect(labels).toEqual(["2 cups flour", "salt to taste"]); }); + + test("tracks separate portions independently while keeping legacy references shared", async () => { + const first = mountIngredients([ingredients.curryPaste]); + await first.setProps({ portionKey: "step-a", portionReferenceIds: [ingredients.curryPaste.referenceId] }); + await first.find(".checkbox").trigger("click"); + const second = mountIngredients([ingredients.curryPaste]); + await second.setProps({ portionKey: "step-b", portionReferenceIds: [ingredients.curryPaste.referenceId] }); + expect(second.find(".checkbox").attributes("aria-pressed")).toBe("false"); + first.unmount(); + const restored = mountIngredients([ingredients.curryPaste]); + await restored.setProps({ portionKey: "step-a", portionReferenceIds: [ingredients.curryPaste.referenceId] }); + expect(restored.find(".checkbox").attributes("aria-pressed")).toBe("true"); + }); }); diff --git a/frontend/app/components/Domain/Recipe/RecipeIngredients.vue b/frontend/app/components/Domain/Recipe/RecipeIngredients.vue index 2f7328ca5..44a6648fc 100644 --- a/frontend/app/components/Domain/Recipe/RecipeIngredients.vue +++ b/frontend/app/components/Domain/Recipe/RecipeIngredients.vue @@ -32,7 +32,7 @@