From 96c8a2b1b3edd56aed63b5f46a9b52628f065223 Mon Sep 17 00:00:00 2001 From: Nicholas Jitkoff Date: Mon, 20 Jun 2022 07:36:50 -0700 Subject: [PATCH] Hide yield and time when not used --- docs/render/recipe.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/render/recipe.js b/docs/render/recipe.js index a5e5ac4..4d51323 100644 --- a/docs/render/recipe.js +++ b/docs/render/recipe.js @@ -190,7 +190,8 @@ function render() { image = image?.url || image; instructions = json.recipeInstructions; let title = clean(json.name); - parent.postMessage({title:title, favicon:"🍴", image:image, wakeLock:true, updateURL:true}, "*"); + let description = clean(json.description); + parent.postMessage({title:title, favicon:"🍴", image:image, description:description wakeLock:true, updateURL:true}, "*"); // let text = instructions.join(" "); @@ -302,8 +303,8 @@ function render() { ), m("h1", title), m(".metadata", - m("div", m("span.yield", m(".icon.material-icons-outlined", "restaurant"), yield)), - m(".time", + (yield) ? m("div", m("span.yield", m(".icon.material-icons-outlined", "restaurant"), yield)) : null, + json.totalTime ? m(".time", m(".icon.material-icons-outlined", "timer"), json.totalTime ? m("span", formatTime(json.totalTime)) : undefined, @@ -311,7 +312,7 @@ function render() { // json.prepTime ? m("span", formatTime(json.prepTime), " prep") : undefined, // json.cookTime ? m("span", ", ", formatTime(json.cookTime), " cook") : undefined, // ")" - ), + ) : null, (rating) ? m("div.rating", m(".icon.material-icons-outlined", "grade"), parseFloat(rating.ratingValue).toFixed(1), " ",