From 2f8ceef0edc91cf3fca545e944e3dfee761df5bf Mon Sep 17 00:00:00 2001 From: June Date: Mon, 17 Nov 2025 15:35:26 +1300 Subject: [PATCH] Add support for ingredient preparation instructions --- web/src/components/detail/InfoView.astro | 21 +++---------------- .../detail/IngredientTableView.astro | 4 ++-- .../detail/StepIngredientSideView.astro | 5 ++--- 3 files changed, 7 insertions(+), 23 deletions(-) diff --git a/web/src/components/detail/InfoView.astro b/web/src/components/detail/InfoView.astro index 0ef9e3e..413b8cb 100644 --- a/web/src/components/detail/InfoView.astro +++ b/web/src/components/detail/InfoView.astro @@ -1,29 +1,14 @@ --- import TagRow from "@component/tagRow"; - const { cookTime, prepTime, description, servings, rating, tags } = Astro.props - -function formatTimeMin(minutes: number) { - if (minutes === 0) return null - const h = Math.floor(minutes / 60); - const m = minutes % 60; - let result = ""; - if (h > 0) result += `${h}h`; - if (m > 0) result += `${m}m`; - if (result === "") result = "0m"; - return result; -} - -// const workTime = formatTimeMin(re.worktime) -// const waitTime = formatTimeMin(re.waittime) ---

{description}

- {servings !== 0 && (

Serves: {servings}

)} - {prepTime && (

{prepTime} Prep

)} - {cookTime && (

{cookTime} Cook

)} + {servings !== 0 && (

Serves {servings}

)} + {prepTime && (

{prepTime} prep

)} + {cookTime && (

{cookTime} cook

)}
\ No newline at end of file diff --git a/web/src/components/detail/IngredientTableView.astro b/web/src/components/detail/IngredientTableView.astro index a82a5bd..de3b63d 100644 --- a/web/src/components/detail/IngredientTableView.astro +++ b/web/src/components/detail/IngredientTableView.astro @@ -10,7 +10,7 @@ const tableView = true { ingredients.map(ing => (
-

• {ing.quantity.value.value} {ing.unit || ''} {ing.name}

+

• {ing.quantity.value.value} {ing.unit || ''} {ing.name}{ing.preparation ? ` (${ing.preparation})` : ''}

)) } @@ -34,7 +34,7 @@ const tableView = true {ing.quantity.value.value} {ing.unit || ''} - {ing.name} + {ing.name}{ing.preparation ? ` (${ing.preparation})` : ''} )) diff --git a/web/src/components/detail/StepIngredientSideView.astro b/web/src/components/detail/StepIngredientSideView.astro index c4272ee..1f5c1d8 100644 --- a/web/src/components/detail/StepIngredientSideView.astro +++ b/web/src/components/detail/StepIngredientSideView.astro @@ -4,8 +4,7 @@ const { ingredients, class: className } = Astro.props;
{ingredients.map(i => ( -
-

• {i.quantity.value.value} {i.unit || ""} {i.name}

-
+
    +
  • {i.quantity.value.value} {i.unit || ""} {i.name} {i.preparation ? `(${i.preparation})` : ''}
))}
\ No newline at end of file