From b82968acec8a5ffc5564de307ce0bbf12cdd6c88 Mon Sep 17 00:00:00 2001 From: vishnuraghavb Date: Tue, 29 Jun 2021 17:07:04 +0530 Subject: [PATCH 1/4] fixed recipe share with sections --- app/components/ViewRecipe.vue | 92 ++++++++++++++++++++--------------- 1 file changed, 54 insertions(+), 38 deletions(-) diff --git a/app/components/ViewRecipe.vue b/app/components/ViewRecipe.vue index e3de4de4..c6c628e2 100644 --- a/app/components/ViewRecipe.vue +++ b/app/components/ViewRecipe.vue @@ -767,60 +767,76 @@ export default { } }, shareRecipe() { - let overview = `${this.recipe.title}\n\n`; - if (this.recipe.rating) - overview += `${localize("stars")}: ${this.recipe.rating}\n`; - overview += `${localize("cui")}: ${localize( - this.recipe.cuisine - )}\n${localize("cat")}: ${localize(this.recipe.category)}\n`; - if (this.recipe.tags.length) - overview += `${localize("ts")}: ${this.recipe.tags.join(", ")}\n`; - if (this.recipe.prepTime != "00:00") - overview += `${localize("prepT")}: ${this.formattedTime( - this.recipe.prepTime - )}\n`; - if (this.recipe.cookTime != "00:00") - overview += `${localize("cookT")}: ${this.formattedTime( - this.recipe.cookTime - )}\n`; + let r = this.recipe; + let overview = `${r.title}\n\n`; + if (r.rating) overview += `${localize("stars")}: ${r.rating}\n`; + overview += `${localize("cui")}: ${localize(r.cuisine)}\n${localize( + "cat" + )}: ${localize(r.category)}\n`; + if (r.tags.length) + overview += `${localize("ts")}: ${r.tags.join(", ")}\n`; + if (r.prepTime != "00:00") + overview += `${localize("prepT")}: ${this.formattedTime(r.prepTime)}\n`; + if (r.cookTime != "00:00") + overview += `${localize("cookT")}: ${this.formattedTime(r.cookTime)}\n`; overview += `${localize("yld")}: ${this.tempYieldQuantity} ${localize( - this.recipe.yieldUnit - )}\n${localize("Difficulty level")}: ${localize( - this.recipe.difficulty - )}\n`; + r.yieldUnit + )}\n${localize("Difficulty level")}: ${localize(r.difficulty)}\n`; let shareContent = overview; - if (this.recipe.ingredients.length) { + if (r.ingredients.length) { let ingredients = `\n\n${localize("ings")}:\n\n`; - this.recipe.ingredients.forEach((e) => { - ingredients += `- ${ - e.quantity - ? this.roundedQuantity(e.quantity) + - " " + - this.$options.filters.L(e.unit) + - " " - : "" - }${e.value}\n`; + r.ingredients.forEach((e) => { + if (e.type) { + ingredients += `- ${ + e.quantity + ? this.roundedQuantity(e.quantity) + + " " + + localize(e.unit) + + " " + : "" + }${e.value}\n`; + } else { + ingredients += `\n${ + e.quantity + ? this.roundedQuantity(e.quantity) + + " " + + localize(e.unit) + + " " + : "" + }${e.value}\n\n`; + } }); shareContent += ingredients; } - if (this.recipe.instructions.length) { + let ins = r.instructions; + if (ins.length) { + let a = 1; + let b = 1; + let group = ins.reduce((acc, e) => { + if (!e.type) { + a = 1; + acc.push(b++); + } else acc.push(a++); + return acc; + }, []); let instructions = `\n\n${localize("inss")}:\n\n`; - this.recipe.instructions.forEach((e, i) => { - instructions += `${i + 1}. ${e.value}\n\n`; - }); + ins.forEach( + (e, i) => + (instructions += (e.type ? group[i] + ". " : "") + `${e.value}\n\n`) + ); shareContent += instructions; } - if (this.recipe.combinations.length) { + if (r.combinations.length) { let combinations = `\n${localize("cmbs")}:\n\n`; - this.recipe.combinations.forEach((e, i) => { + r.combinations.forEach((e, i) => { combinations += `${i + 1}. ${this.getCombinationTitle(e)}\n\n`; }); shareContent += combinations; } - if (this.recipe.notes.length) { + if (r.notes.length) { let notes = `\n${localize("nos")}:\n\n`; - this.recipe.notes.forEach((e, i) => { + r.notes.forEach((e, i) => { notes += `${i + 1}. ${e.value}\n\n`; }); shareContent += notes; From bc46115e630b27647fe4849b1c48730711503574 Mon Sep 17 00:00:00 2001 From: vishnuraghavb Date: Tue, 29 Jun 2021 17:07:19 +0530 Subject: [PATCH 2/4] fixed units dialog shows up twice --- app/components/EditRecipe.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/components/EditRecipe.vue b/app/components/EditRecipe.vue index accef551..9805e44d 100644 --- a/app/components/EditRecipe.vue +++ b/app/components/EditRecipe.vue @@ -155,7 +155,7 @@ col="2" :text="`${recipe.ingredients[i].unit}` | L" editable="false" - @focus="showUnits(1, i)" + @focus="!modalOpen && showUnits(1, i)" @tap="showUnits(0, i)" /> { + this.modalOpen = 0; if (action == "aNBtn") { this.$showModal(Prompt, { props: { From 2f1c5d42c49970a21fd35615e92427eac3657a88 Mon Sep 17 00:00:00 2001 From: vishnuraghavb Date: Tue, 29 Jun 2021 20:31:03 +0530 Subject: [PATCH 3/4] improved mark recipes as done --- app/components/EnRecipes.vue | 1 + app/components/ViewRecipe.vue | 104 +++++++++++++++++++--------------- app/store.ts | 14 ++--- 3 files changed, 65 insertions(+), 54 deletions(-) diff --git a/app/components/EnRecipes.vue b/app/components/EnRecipes.vue index 6da3e153..317c2068 100644 --- a/app/components/EnRecipes.vue +++ b/app/components/EnRecipes.vue @@ -608,6 +608,7 @@ export default { }, pgUnload() { if (this.shake) stopAccelerometerUpdates(); + this.releaseBackEvent(); }, abLoad({ object }) { this.appbar = object; diff --git a/app/components/ViewRecipe.vue b/app/components/ViewRecipe.vue index c6c628e2..92c4a2c0 100644 --- a/app/components/ViewRecipe.vue +++ b/app/components/ViewRecipe.vue @@ -66,7 +66,7 @@ :class="{ r: RTL }" > - + @@ -120,7 +120,7 @@ @@ -234,7 +234,7 @@ col="2" v-else class="ico" - :text="icon.done" + :text="recipeTried ? icon.try : icon.done" @tap="toggle('tried', 1)" />