From 7e48993f7d4a1e3541a0e241689daf84a07c0b10 Mon Sep 17 00:00:00 2001 From: Ryan Trickett Date: Wed, 20 Sep 2023 05:03:18 +0200 Subject: [PATCH 01/37] =?UTF-8?q?=F0=9F=90=9B=20(app)=20Recommend=20Bug=20?= =?UTF-8?q?Fixes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libs/app/recommend/data-access/src/recommend.state.ts | 10 +++++++--- .../ui/src/item-edit-step/item-edit-step.html | 2 +- .../recommend/ui/src/item-edit-step/item-edit-step.ts | 4 ++++ .../recommend/ui/src/stepper-form/stepper-form.html | 11 +++++++++-- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/libs/app/recommend/data-access/src/recommend.state.ts b/libs/app/recommend/data-access/src/recommend.state.ts index 48789ec3..c12213ea 100644 --- a/libs/app/recommend/data-access/src/recommend.state.ts +++ b/libs/app/recommend/data-access/src/recommend.state.ts @@ -35,7 +35,7 @@ import { export interface RecommendStateModel { recommendRequest: IRecommend | null; - recipes: IRecipe[]; + recipes: IRecipe[] | null; } @State({ name: 'recommend', @@ -136,7 +136,7 @@ export interface RecommendStateModel { prepTime: '30 - 60 Minutes', }, }, - recipes: [], + recipes: null, }, }) @Injectable() @@ -176,7 +176,7 @@ export class RecommendState { } @Selector() - static getRecipes(state: RecommendStateModel): IRecipe[] { + static getRecipes(state: RecommendStateModel): IRecipe[] | null { return state.recipes; } @@ -257,6 +257,10 @@ export class RecommendState { }: StateContext) { const recommendRequest = getState().recommendRequest; + patchState({ + recipes: null + }) + if (recommendRequest) { this.recommendApi.getRecommendations(recommendRequest).subscribe({ next: (data) => { diff --git a/libs/app/recommend/ui/src/item-edit-step/item-edit-step.html b/libs/app/recommend/ui/src/item-edit-step/item-edit-step.html index 918e40d9..916f2a80 100644 --- a/libs/app/recommend/ui/src/item-edit-step/item-edit-step.html +++ b/libs/app/recommend/ui/src/item-edit-step/item-edit-step.html @@ -66,7 +66,7 @@

Your Ingredients List

> -

Your Ingredients List is Empty

+

Your Ingredients List is Empty. Add Ingredients to Get Ingredient Based Recommendations.

diff --git a/libs/app/recommend/ui/src/item-edit-step/item-edit-step.ts b/libs/app/recommend/ui/src/item-edit-step/item-edit-step.ts index 906d616f..faab433f 100644 --- a/libs/app/recommend/ui/src/item-edit-step/item-edit-step.ts +++ b/libs/app/recommend/ui/src/item-edit-step/item-edit-step.ts @@ -36,6 +36,10 @@ export class ItemEditStep { } this.store.dispatch(new AddIngredient(newIngredient)); + + this.ingredientName = ''; + this.ingredientAmount = 1; + this.ingredientScale = ''; } closeScanner() { diff --git a/libs/app/recommend/ui/src/stepper-form/stepper-form.html b/libs/app/recommend/ui/src/stepper-form/stepper-form.html index 16c86ffa..364fd1cc 100644 --- a/libs/app/recommend/ui/src/stepper-form/stepper-form.html +++ b/libs/app/recommend/ui/src/stepper-form/stepper-form.html @@ -30,7 +30,6 @@

{{stepContent}}

+ From 445e85d485d0bff312faf0a2f0c710a7b1f1c614 Mon Sep 17 00:00:00 2001 From: Ryan Trickett Date: Wed, 20 Sep 2023 05:08:00 +0200 Subject: [PATCH 02/37] =?UTF-8?q?=F0=9F=90=9B=20(app)=20Small=20Bug=20Fixe?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libs/app/recipe/data-access/src/recipe.state.ts | 5 +---- libs/app/recipe/feature/src/recipe.page.html | 4 ++-- libs/app/recipe/feature/src/recipe.page.ts | 16 +++++++++------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/libs/app/recipe/data-access/src/recipe.state.ts b/libs/app/recipe/data-access/src/recipe.state.ts index 1c198d80..4388f236 100644 --- a/libs/app/recipe/data-access/src/recipe.state.ts +++ b/libs/app/recipe/data-access/src/recipe.state.ts @@ -80,8 +80,7 @@ export class RecipeState { } }, (error: Error) => { - console.error('Failed to retrieve recipe: ', error); - this.store.dispatch(new ShowInfo("Could Not Retrieve Recipe")); + this.store.dispatch(new ShowError("Could Not Retrieve Recipe")); } ); } @@ -100,11 +99,9 @@ export class RecipeState { patchState({ recipe: recipe, }); - this.store.dispatch(new ShowSuccess('Recipe Rating Updated Successfully')); }, (error: Error) => { console.error('Failed to update recipe:', error); - this.store.dispatch(new ShowError(error.message)); } ); diff --git a/libs/app/recipe/feature/src/recipe.page.html b/libs/app/recipe/feature/src/recipe.page.html index eec3212c..9139c291 100644 --- a/libs/app/recipe/feature/src/recipe.page.html +++ b/libs/app/recipe/feature/src/recipe.page.html @@ -75,7 +75,7 @@

Tags

Creator

-

{{ recipe?.creator }}

+

{{ recipe.creator }}

@@ -83,7 +83,7 @@

Creator

Description

-

{{ recipe?.description }}

+

{{ recipe.description }}

diff --git a/libs/app/recipe/feature/src/recipe.page.ts b/libs/app/recipe/feature/src/recipe.page.ts index 2cb13599..8c6ac8a8 100644 --- a/libs/app/recipe/feature/src/recipe.page.ts +++ b/libs/app/recipe/feature/src/recipe.page.ts @@ -4,7 +4,7 @@ import { ActivatedRoute } from '@angular/router'; import { Location } from '@angular/common'; import { Select, Store } from '@ngxs/store'; import { RecipeState } from '@fridge-to-plate/app/recipe/data-access'; -import { Observable } from 'rxjs'; +import { Observable, take } from 'rxjs'; import { ShowError } from '@fridge-to-plate/app/error/utils'; import { Navigate } from '@ngxs/router-plugin'; import { @@ -40,12 +40,9 @@ export class RecipePage implements OnInit { ) {} hasTags = false; - isDescriptionExpanded = false; + isDescriptionUnexpanded = true; presentIngredients: IIngredient[] = []; missingIngredients: IIngredient[] = []; - toggleDescriptionExpanded() { - this.isDescriptionExpanded = !this.isDescriptionExpanded; - } ngOnInit(): void { this.forceLoading = true; @@ -73,13 +70,13 @@ export class RecipePage implements OnInit { this.recipe$.subscribe((stateRecipe) => { this.recipe = stateRecipe; if (this.recipe) { - this.store.dispatch(new IncreaseViews()); - if (stateRecipe.youtubeId) { this.safeUrl = this._sanitizer.bypassSecurityTrustResourceUrl( `https://www.youtube.com/embed/${this.recipe.youtubeId}` ); } + + this.store.dispatch(new IncreaseViews()); this.ingredients$.subscribe((ingredients) => { @@ -112,4 +109,9 @@ export class RecipePage implements OnInit { changeIngredientUnits() { this.store.dispatch(new ChangeMeasurementType(this.measurementUnit)); } + + toggleDescriptionExpanded() { + this.isDescriptionUnexpanded = !this.isDescriptionUnexpanded; + } + } From 9e51fffbb459e501c11a454dcc4ffe8f3a241046 Mon Sep 17 00:00:00 2001 From: Ryan Trickett Date: Wed, 20 Sep 2023 05:22:25 +0200 Subject: [PATCH 03/37] =?UTF-8?q?=F0=9F=90=9B=20(app)=20Fixing=20Small=20B?= =?UTF-8?q?ugs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/meal-plan-modal/meal-plan-modal.component.html | 10 ++++++---- .../ui/src/barcode-modal/barcode-modal.component.html | 3 ++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/libs/app/recipe/ui/src/meal-plan-modal/meal-plan-modal.component.html b/libs/app/recipe/ui/src/meal-plan-modal/meal-plan-modal.component.html index 4a2659d4..3d56c624 100644 --- a/libs/app/recipe/ui/src/meal-plan-modal/meal-plan-modal.component.html +++ b/libs/app/recipe/ui/src/meal-plan-modal/meal-plan-modal.component.html @@ -6,13 +6,15 @@
-

Choose Specific Meal

+

Add to Meal Plan

+ +