fix crash when no quantity is given

This commit is contained in:
2025-11-17 16:36:28 +13:00
parent 56534c8bda
commit 3c708d4f77
2 changed files with 2 additions and 2 deletions

View File

@@ -32,7 +32,7 @@ const tableView = true
ingredients.map((ing, index) => (
<>
<tr class="border-t border-white/10 cursor-pointer hover:bg-white/10 transition-opacity ingredient-row" data-index={index}>
<td class="px-4 py-2">{ing.quantity.value.value}</td>
<td class="px-4 py-2">{ing.quantity ? ing.quantity.value.value : ''}</td>
<td class="px-4 py-2">{ing.unit || ''}</td>
<td class="px-4 py-2">{ing.name}{ing.preparation ? ` (${ing.preparation})` : ''}</td>
</tr>

View File

@@ -5,6 +5,6 @@ const { ingredients, class: className } = Astro.props;
<div class={className}>
{ingredients.map(i => (
<ul class="text-sm">
<li class="">{i.quantity.value.value} {i.unit || ""} {i.name} {i.preparation ? `(${i.preparation})` : ''}</li class=""> </ul>
<li class="">{i.quantity ? i.quantity.value.value : ''} {i.unit || ""} {i.name} {i.preparation ? `(${i.preparation})` : ''}</li class=""> </ul>
))}
</div>