From d583ce89712efdecb545f1846a85f94516d9c8b1 Mon Sep 17 00:00:00 2001 From: julianpoyourow Date: Sun, 13 Oct 2024 21:54:53 +0000 Subject: [PATCH 1/3] fix: do not display meal plan edit button if not the owner --- .../meal-plan-popover.page.html | 3 ++- .../meal-plan-popover.page.ts | 20 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/packages/frontend/src/app/pages/meal-plan-components/meal-plan-popover/meal-plan-popover.page.html b/packages/frontend/src/app/pages/meal-plan-components/meal-plan-popover/meal-plan-popover.page.html index 475026a6..01d1585e 100644 --- a/packages/frontend/src/app/pages/meal-plan-components/meal-plan-popover/meal-plan-popover.page.html +++ b/packages/frontend/src/app/pages/meal-plan-components/meal-plan-popover/meal-plan-popover.page.html @@ -1,4 +1,4 @@ - + {{ 'pages.mealPlanPopover.options.title' | translate }} @@ -96,6 +96,7 @@ { + this.loading = false; + }); + } + + async loadUser() { + const response = await this.userService.getMyProfile({ + 401: () => {}, + }); + if (!response.success) return; + + this.isOwner = response.data.id === this.mealPlan.userId; + } + savePreferences() { this.preferencesService.save(); From f34ecca6e21f68293b029b246d38ffd4f67bb0bd Mon Sep 17 00:00:00 2001 From: julianpoyourow Date: Mon, 14 Oct 2024 02:13:56 +0000 Subject: [PATCH 2/3] chore: bump to ionic v8.3.2 --- package-lock.json | 42 +++++++++++++++++++--------------- package.json | 2 +- packages/frontend/angular.json | 4 ++-- 3 files changed, 26 insertions(+), 22 deletions(-) diff --git a/package-lock.json b/package-lock.json index c2b263fe..07f6cb3e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,7 +26,7 @@ "@fanoutio/grip": "^3.3.1", "@fanoutio/serve-grip": "^1.3.1", "@google-cloud/vision": "^4.1.0", - "@ionic/angular": "^7.8.2", + "@ionic/angular": "^8.3.2", "@julianpoy/recipe-clipper": "^3.1.0", "@ngx-loading-bar/core": "^6.0.2", "@ngx-translate/core": "^15.0.0", @@ -6698,21 +6698,22 @@ } }, "node_modules/@ionic/angular": { - "version": "7.8.2", - "resolved": "https://registry.npmjs.org/@ionic/angular/-/angular-7.8.2.tgz", - "integrity": "sha512-riw1BnvsabDZoo8WGgD+XRNJqP3RjAWmpLL0OWSoF7yCYdm407D0kdHMcDrve/Hgc7UMiwbFZ7cDqdmzyf1hjg==", + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/@ionic/angular/-/angular-8.3.2.tgz", + "integrity": "sha512-mbQgWWOzOHdzYEuixJNl2HJ+QUPAakvaG2D/oh7E+gvmA732ppnpHWF8XR35bpIfQJeBby6/mNZN0Bp9RWAkWw==", + "license": "MIT", "dependencies": { - "@ionic/core": "7.8.2", + "@ionic/core": "8.3.2", "ionicons": "^7.0.0", "jsonc-parser": "^3.0.0", "tslib": "^2.3.0" }, "peerDependencies": { - "@angular/core": ">=14.0.0", - "@angular/forms": ">=14.0.0", - "@angular/router": ">=14.0.0", + "@angular/core": ">=16.0.0", + "@angular/forms": ">=16.0.0", + "@angular/router": ">=16.0.0", "rxjs": ">=7.5.0", - "zone.js": ">=0.11.0" + "zone.js": ">=0.13.0" } }, "node_modules/@ionic/angular-toolkit": { @@ -6741,11 +6742,12 @@ } }, "node_modules/@ionic/core": { - "version": "7.8.2", - "resolved": "https://registry.npmjs.org/@ionic/core/-/core-7.8.2.tgz", - "integrity": "sha512-1Iwe4XSaEYD0u7U/AnnKYNRXmPxx/doTl6pExXq/nlEd7q0AykRkPEy5rClqrQcJOrgFogAx1FwSObfgm0xnNw==", + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/@ionic/core/-/core-8.3.2.tgz", + "integrity": "sha512-ptiDXnn4131eKpY862lv7c9xxjly7vi4O+WWCES78E+hXHvTEAundcA5F8eQyb0MFIFvCnOxreTZjRJJnHqPYw==", + "license": "MIT", "dependencies": { - "@stencil/core": "^4.12.2", + "@stencil/core": "4.20.0", "ionicons": "^7.2.2", "tslib": "^2.1.0" } @@ -10381,9 +10383,10 @@ } }, "node_modules/@stencil/core": { - "version": "4.13.0", - "resolved": "https://registry.npmjs.org/@stencil/core/-/core-4.13.0.tgz", - "integrity": "sha512-gg+gtBWekQ08mDja8GVAUHNu+rrFhQaKZDvfhnS3l/5JbYiJddTimuDPPhuc0sR0JZL1iRdJTJSa+JbvmnQ1cQ==", + "version": "4.20.0", + "resolved": "https://registry.npmjs.org/@stencil/core/-/core-4.20.0.tgz", + "integrity": "sha512-WPrTHFngvN081RY+dJPneKQLwnOFD60OMCOQGmmSHfCW0f4ujPMzzhwWU1gcSwXPWXz5O+8cBiiCaxAbJU7kAg==", + "license": "MIT", "bin": { "stencil": "bin/stencil" }, @@ -19476,9 +19479,10 @@ } }, "node_modules/ionicons": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/ionicons/-/ionicons-7.3.1.tgz", - "integrity": "sha512-1boG4EQTBBpQ4/0PU60Yi78Iw/k8iNtKu9c0NmsbzHGnWAcwpiovG9Wi/rk5UlF+DC+CR4XDCxKo91YqvAxkww==", + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/ionicons/-/ionicons-7.4.0.tgz", + "integrity": "sha512-ZK94MMqgzMCPPMhmk8Ouu6goyVHFIlw/ACP6oe3FrikcI0N7CX0xcwVaEbUc0G/v3W0shI93vo+9ve/KpvcNhQ==", + "license": "MIT", "dependencies": { "@stencil/core": "^4.0.3" } diff --git a/package.json b/package.json index c069baf3..782e5f38 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "@fanoutio/grip": "^3.3.1", "@fanoutio/serve-grip": "^1.3.1", "@google-cloud/vision": "^4.1.0", - "@ionic/angular": "^7.8.2", + "@ionic/angular": "^8.3.2", "@julianpoy/recipe-clipper": "^3.1.0", "@ngx-loading-bar/core": "^6.0.2", "@ngx-translate/core": "^15.0.0", diff --git a/packages/frontend/angular.json b/packages/frontend/angular.json index 594a356e..bb36a0a7 100644 --- a/packages/frontend/angular.json +++ b/packages/frontend/angular.json @@ -34,10 +34,10 @@ ], "styles": [ { - "input": "src/theme/variables.scss" + "input": "src/global.scss" }, { - "input": "src/global.scss" + "input": "src/theme/variables.scss" }, { "input": "src/app/app.scss" From 6dd038463d0c8f2bf995e390b92589835e8da639 Mon Sep 17 00:00:00 2001 From: julianpoyourow Date: Mon, 14 Oct 2024 02:38:55 +0000 Subject: [PATCH 3/3] fix: scale modal doing strange things on modal --- packages/frontend/src/app/app.scss | 5 +++++ .../select-ingredients.component.ts | 11 ++++++----- .../app/modals/scale-recipe/scale-recipe.component.ts | 8 ++++---- .../app/pages/recipe-components/recipe/recipe.page.ts | 7 ++++--- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/packages/frontend/src/app/app.scss b/packages/frontend/src/app/app.scss index 15239812..1d757ab5 100644 --- a/packages/frontend/src/app/app.scss +++ b/packages/frontend/src/app/app.scss @@ -235,3 +235,8 @@ ion-button.button-outline { margin-right: auto !important; color-scheme: light; } + +.scaleRecipeModal { + --max-width: 300px; + --max-height: 300px; +} diff --git a/packages/frontend/src/app/components/select-ingredients/select-ingredients.component.ts b/packages/frontend/src/app/components/select-ingredients/select-ingredients.component.ts index 16c3adf3..7166d245 100644 --- a/packages/frontend/src/app/components/select-ingredients/select-ingredients.component.ts +++ b/packages/frontend/src/app/components/select-ingredients/select-ingredients.component.ts @@ -1,5 +1,5 @@ import { Component, Input, Output, EventEmitter } from "@angular/core"; -import { PopoverController } from "@ionic/angular"; +import { ModalController } from "@ionic/angular"; import { RecipeService, ParsedIngredient } from "../../services/recipe.service"; import { ScaleRecipeComponent } from "~/modals/scale-recipe/scale-recipe.component"; @@ -45,21 +45,22 @@ export class SelectIngredientsComponent { } constructor( - private popoverCtrl: PopoverController, + private modalCtrl: ModalController, private recipeService: RecipeService, private preferencesService: PreferencesService, ) {} async changeScale() { - const popover = await this.popoverCtrl.create({ + const modal = await this.modalCtrl.create({ component: ScaleRecipeComponent, componentProps: { scale: this.scale.toString(), }, + cssClass: "scaleRecipeModal", }); - await popover.present(); - const { data } = await popover.onDidDismiss(); + await modal.present(); + const { data } = await modal.onDidDismiss(); if (data?.scale) { this.scale = data.scale; diff --git a/packages/frontend/src/app/modals/scale-recipe/scale-recipe.component.ts b/packages/frontend/src/app/modals/scale-recipe/scale-recipe.component.ts index 3c6b4778..0f92bfe7 100644 --- a/packages/frontend/src/app/modals/scale-recipe/scale-recipe.component.ts +++ b/packages/frontend/src/app/modals/scale-recipe/scale-recipe.component.ts @@ -1,5 +1,5 @@ import { Component, Input } from "@angular/core"; -import { PopoverController } from "@ionic/angular"; +import { ModalController } from "@ionic/angular"; import fractionjs from "fraction.js"; @Component({ @@ -10,7 +10,7 @@ import fractionjs from "fraction.js"; export class ScaleRecipeComponent { @Input() scale: string = "1"; - constructor(private popoverCtrl: PopoverController) {} + constructor(private modalCtrl: ModalController) {} format(input: string) { // Support fractions @@ -26,11 +26,11 @@ export class ScaleRecipeComponent { } close() { - this.popoverCtrl.dismiss(); + this.modalCtrl.dismiss(); } apply() { - this.popoverCtrl.dismiss({ + this.modalCtrl.dismiss({ scale: this.format(this.scale), }); } diff --git a/packages/frontend/src/app/pages/recipe-components/recipe/recipe.page.ts b/packages/frontend/src/app/pages/recipe-components/recipe/recipe.page.ts index ffa684f3..e2968d44 100644 --- a/packages/frontend/src/app/pages/recipe-components/recipe/recipe.page.ts +++ b/packages/frontend/src/app/pages/recipe-components/recipe/recipe.page.ts @@ -317,15 +317,16 @@ export class RecipePage { } async changeScale() { - const popover = await this.popoverCtrl.create({ + const modal = await this.modalCtrl.create({ component: ScaleRecipeComponent, componentProps: { scale: this.scale.toString(), }, + cssClass: "scaleRecipeModal", }); - await popover.present(); - const { data } = await popover.onDidDismiss(); + await modal.present(); + const { data } = await modal.onDidDismiss(); if (data?.scale) { this.scale = data.scale;