Update cookcli-recipe-strategy.js

This commit is contained in:
TheThomaas 2026-09-16 14:46:15 +02:00
parent 3ab65d2a17
commit cde1e90241

View file

@ -244,14 +244,12 @@ class CookCliRecipeViewStrategy extends HTMLElement {
const stepIngredients = (step.items || []).filter((item) => item.type === "ingredient"); const stepIngredients = (step.items || []).filter((item) => item.type === "ingredient");
if (stepIngredients.length) { if (stepIngredients.length) {
const lines = stepIngredients.map((item) => { const lines = stepIngredients.map((item) => {
const qty = item.quantity const qty = item.quantity ?? ""
? `${item.quantity.value ?? ""} ${item.quantity.unit ?? ""}`.trim() ? `${item.quantity.value ?? ""} ${item.quantity.unit ?? ""}`.trim()
: ""; : "";
return `- ${qty ? `**${qty}** ` : ""}${item.name}`; return `- ${qty ? `**${qty}** ` : ""}${item.name ?? ""}`;
}); });
if (lines.trim() !== "") { leftCards.push({ type: "markdown", content: lines.join("\n") });
leftCards.push({ type: "markdown", content: lines.join("\n") });
}
} }
if (config.timer_entity) { if (config.timer_entity) {