Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion playground/app/components/recipe/StepContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ function isGroupedItemSelected(item: IngredientItem): boolean {
return isAlternativeSelected(props.recipe, props.choices ?? {}, item);
}

/**
* Preparation lives on the referenced ingredient (distinct preparations
* yield distinct ingredient entries), so it is resolved per alternative.
*/
function getPreparation(alt: IngredientAlternative): string | undefined {
return props.recipe.ingredients[alt.index]?.preparation;
}

/**
* Convert equivalents to a QuantityWithPlainUnit array.
*/
Expand Down Expand Up @@ -118,7 +126,15 @@ function getVisibleAlternatives(
/>
{{ " " }}
</template>
{{ item.alternatives[0]?.displayName }}
{{ item.alternatives[0]?.displayName
}}<span
v-if="
item.alternatives[0] && getPreparation(item.alternatives[0])
"
class="font-normal text-gray-500 dark:text-gray-300"
>
({{ getPreparation(item.alternatives[0]) }})</span
>
</span>
</template>
<!-- Inline alternatives: show selected or all -->
Expand Down Expand Up @@ -154,6 +170,12 @@ function getVisibleAlternatives(
}"
>{{ visibleAlt.alt.displayName }}</span
>
<span
v-if="getPreparation(visibleAlt.alt)"
class="font-normal text-gray-500 dark:text-gray-300"
>
({{ getPreparation(visibleAlt.alt) }})</span
>
<template v-if="visibleAlt.alt.note && !hasInlineChoice(item)">
<span
class="font-normal text-gray-500 italic dark:text-gray-300"
Expand Down
Loading