diff --git a/frontend/src/components/Recipe/RecipeEditor/NutritionEditor.vue b/frontend/src/components/Recipe/RecipeEditor/NutritionEditor.vue index ed1888dd5..b74b54b72 100644 --- a/frontend/src/components/Recipe/RecipeEditor/NutritionEditor.vue +++ b/frontend/src/components/Recipe/RecipeEditor/NutritionEditor.vue @@ -1,16 +1,33 @@ @@ -19,17 +36,13 @@ export default { props: { value: {}, + edit: { + type: Boolean, + default: true, + }, }, data() { return { - nutrition: { - calories: null, - fatContent: null, - fiberContent: null, - proteinContent: null, - sodiumContent: null, - sugarContent: null, - }, labels: { calories: { label: "Calories", @@ -43,6 +56,18 @@ export default { }, }; }, + computed: { + showViewer() { + return !this.edit && this.valueNotNull; + }, + valueNotNull() { + for (const property in this.value) { + const valueProperty = this.value[property]; + if (valueProperty && valueProperty !== "") return true; + } + return false; + }, + }, methods: { updateValue(key, value) { diff --git a/frontend/src/components/Recipe/RecipeEditor/index.vue b/frontend/src/components/Recipe/RecipeEditor/index.vue index 9c7b8fb62..cfab1e49b 100644 --- a/frontend/src/components/Recipe/RecipeEditor/index.vue +++ b/frontend/src/components/Recipe/RecipeEditor/index.vue @@ -92,7 +92,7 @@ auto-grow solo dense - rows="2" + rows="1" > mdi-plus - + diff --git a/frontend/src/components/Recipe/RecipeViewer/index.vue b/frontend/src/components/Recipe/RecipeViewer/index.vue index d50e8cd01..813a8d5ab 100644 --- a/frontend/src/components/Recipe/RecipeViewer/index.vue +++ b/frontend/src/components/Recipe/RecipeViewer/index.vue @@ -40,6 +40,7 @@ :isCategory="false" /> + + @@ -80,6 +82,7 @@