Update cookcli-recipe-strategy.js
This commit is contained in:
parent
a2aabbf8a9
commit
9e33d3c7df
|
|
@ -34,7 +34,7 @@
|
||||||
* Cartes utilisées, toutes tierces ou natives — aucune carte custom pour le
|
* Cartes utilisées, toutes tierces ou natives — aucune carte custom pour le
|
||||||
* rendu du contenu lui-même :
|
* rendu du contenu lui-même :
|
||||||
* - markdown (native) : titre, image, ustensiles, texte des étapes
|
* - markdown (native) : titre, image, ustensiles, texte des étapes
|
||||||
* - todo-list (native) : checklist des ingrédients (todo.py backend)
|
* - custom:cookcli-checklist-card : checklist des ingrédients (Résumé et étapes), état local
|
||||||
* - button (native) : Commencer / Précédent / Suivant / Démarrer minuteur
|
* - button (native) : Commencer / Précédent / Suivant / Démarrer minuteur
|
||||||
* - custom:circular-timer-card : affichage/contrôle du minuteur partagé
|
* - custom:circular-timer-card : affichage/contrôle du minuteur partagé
|
||||||
* - custom:tabdeck-card : les onglets (Résumé + une par étape)
|
* - custom:tabdeck-card : les onglets (Résumé + une par étape)
|
||||||
|
|
@ -339,18 +339,21 @@ class CookCliRecipeViewStrategy extends HTMLElement {
|
||||||
|
|
||||||
const rightCards = [];
|
const rightCards = [];
|
||||||
|
|
||||||
if (recipe.todo_entity_id) {
|
const ingredients = recipe.ingredients || [];
|
||||||
|
if (ingredients.length) {
|
||||||
rightCards.push({
|
rightCards.push({
|
||||||
type: "todo-list",
|
type: "custom:cookcli-checklist-card",
|
||||||
entity: recipe.todo_entity_id,
|
// État coché propre à cette recette, indépendant de celui des étapes.
|
||||||
title: "Ingrédients",
|
storage_key: `${config.path}:summary`,
|
||||||
card_mod: {
|
items: ingredients.map((ingredient) => {
|
||||||
style: `
|
const quantity = ingredient.quantity || {};
|
||||||
ha-list .header {
|
return {
|
||||||
display: none;
|
quantity: [quantity.value, quantity.unit]
|
||||||
}
|
.filter((part) => part !== null && part !== undefined && part !== "")
|
||||||
`
|
.join(" "),
|
||||||
}
|
name: ingredient.name ?? "",
|
||||||
|
};
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue