Update cookcli-recipe-strategy.js

This commit is contained in:
TheThomaas 2026-09-24 13:04:46 +02:00
parent f876730ead
commit 67ee41cb24

View file

@ -204,8 +204,8 @@ class CookCliRecipeViewStrategy extends HTMLElement {
name: label, name: label,
icon, icon,
tap_action: { tap_action: {
action: "call-service", action: "perform-action",
service: "input_number.set_value", perform_action: "input_number.set_value",
target: { entity_id: entity }, target: { entity_id: entity },
data: { value: targetIndex }, data: { value: targetIndex },
}, },
@ -221,7 +221,7 @@ class CookCliRecipeViewStrategy extends HTMLElement {
} }
content += `## ${recipe.title || ""}\n`; content += `## ${recipe.title || ""}\n`;
if (recipe.cookware && recipe.cookware.length) { if (recipe.cookware && recipe.cookware.length) {
content += `\n**Ustensiles** : ${recipe.cookware.map((c) => c.name).join(", ")}\n`; content += `\n TEST \n**Ustensiles** : ${recipe.cookware.map((c) => c.name).join(", ")}\n`;
} }
const cards = [{ const cards = [{
@ -263,7 +263,9 @@ class CookCliRecipeViewStrategy extends HTMLElement {
cards.push({ type: "vertical-stack", cards: rightCards }); cards.push({ type: "vertical-stack", cards: rightCards });
return { name: "Résumé", icon: "mdi:book-open-variant", card: { type: "horizontal-stack", cards } }; const tab = { name: "Résumé", icon: "mdi:book-open-variant", card: { type: "horizontal-stack", cards } };
if (config.step_entity) tab.auto_select = { entity: config.step_entity, state: "0.0" };
return tab;
} }
static _stepTab(section, step, tabIndex, isLast, config) { static _stepTab(section, step, tabIndex, isLast, config) {
@ -291,8 +293,8 @@ class CookCliRecipeViewStrategy extends HTMLElement {
name: `Démarrer ${label}`, name: `Démarrer ${label}`,
icon: "mdi:timer-outline", icon: "mdi:timer-outline",
tap_action: { tap_action: {
action: "call-service", action: "perform-action",
service: "timer.start", perform_action: "timer.start",
target: { entity_id: config.timer_entity }, target: { entity_id: config.timer_entity },
data: { duration: this._secondsToHms(seconds) }, data: { duration: this._secondsToHms(seconds) },
}, },
@ -328,10 +330,12 @@ class CookCliRecipeViewStrategy extends HTMLElement {
cards.push({ type: "horizontal-stack", cards: navButtons }); cards.push({ type: "horizontal-stack", cards: navButtons });
} }
return { const tab = {
name: section.name ? `${section.name} ${step.number ?? ""}`.trim() : `Étape ${tabIndex}`, name: section.name ? `${section.name} ${step.number ?? ""}`.trim() : `Étape ${tabIndex}`,
card: { type: "vertical-stack", cards }, card: { type: "vertical-stack", cards },
}; };
if (config.step_entity) tab.auto_select = { entity: config.step_entity, state: `${tabIndex}.0` };
return tab;
} }
static _renderStepMarkdown(step) { static _renderStepMarkdown(step) {