diff --git a/packages/frontend/src/app/pages/recipe-components/recipe-details-popover/recipe-details-popover.page.html b/packages/frontend/src/app/pages/recipe-components/recipe-details-popover/recipe-details-popover.page.html
index 941798b60..7768950e1 100644
--- a/packages/frontend/src/app/pages/recipe-components/recipe-details-popover/recipe-details-popover.page.html
+++ b/packages/frontend/src/app/pages/recipe-components/recipe-details-popover/recipe-details-popover.page.html
@@ -21,93 +21,170 @@
{{ 'pages.recipeDetailsPopover.actions' | translate }}
-
-
- {{ 'pages.recipeDetailsPopover.addToShoppingList' | translate }}
-
-
-
-
- {{ 'pages.recipeDetailsPopover.addToMealPlan' | translate }}
-
-
-
-
- {{ 'pages.recipeDetailsPopover.share' | translate }}
-
-
-
-
- {{ 'pages.recipeDetailsPopover.print' | translate }}
-
-
-
-
-
- {{ 'pages.recipeDetailsPopover.unPinRecipe' | translate }}
-
-
- {{ 'pages.recipeDetailsPopover.pinRecipe' | translate }}
-
-
-
-
-
- {{ 'pages.recipeDetailsPopover.edit' | translate }}
-
-
-
-
- {{ 'pages.recipeDetailsPopover.makeACopy' | translate }}
-
+
+
+
+
+ {{ 'pages.recipeDetails.inInbox' | translate }}
+
+
+
-
- {{ 'pages.recipeDetailsPopover.dangerZone' | translate }}
-
+
+
+ {{ 'pages.recipeDetailsPopover.saveToMyRecipes' | translate }}
+
+
+
+ {{ 'pages.recipeDetailsPopover.dangerZone' | translate }}
+
+
+
+
+ {{ 'pages.recipeDetailsPopover.delete' | translate }}
+
+
+
+
+
+
+
+ {{ 'pages.recipeDetails.doesNotBelongToYou' | translate }}
+
+
+
+
+
+
+ {{ 'pages.recipeDetailsPopover.saveToMyRecipes' | translate }}
+
+
+
+
+
+
+
+ {{ 'pages.recipeDetails.requiresAccountToSave' | translate }}
+
+
+
-
-
- {{ 'pages.recipeDetailsPopover.delete' | translate }}
-
+
+
+ {{ 'pages.recipeDetailsPopover.registerOrLoginToSave' | translate }}
+
+
+
+
+
+
+ {{ 'pages.recipeDetailsPopover.addToShoppingList' | translate }}
+
+
+
+
+ {{ 'pages.recipeDetailsPopover.addToMealPlan' | translate }}
+
+
+
+
+ {{ 'pages.recipeDetailsPopover.share' | translate }}
+
+
+
+
+ {{ 'pages.recipeDetailsPopover.print' | translate }}
+
+
+
+
+
+ {{ 'pages.recipeDetailsPopover.unPinRecipe' | translate }}
+
+
+ {{ 'pages.recipeDetailsPopover.pinRecipe' | translate }}
+
+
+
+
+
+ {{ 'pages.recipeDetailsPopover.edit' | translate }}
+
+
+
+
+ {{ 'pages.recipeDetailsPopover.makeACopy' | translate }}
+
+
+
+ {{ 'pages.recipeDetailsPopover.dangerZone' | translate }}
+
+
+
+
+ {{ 'pages.recipeDetailsPopover.delete' | translate }}
+
+
diff --git a/packages/frontend/src/app/pages/recipe-components/recipe-details-popover/recipe-details-popover.page.ts b/packages/frontend/src/app/pages/recipe-components/recipe-details-popover/recipe-details-popover.page.ts
index e622af95c..a85cd3079 100644
--- a/packages/frontend/src/app/pages/recipe-components/recipe-details-popover/recipe-details-popover.page.ts
+++ b/packages/frontend/src/app/pages/recipe-components/recipe-details-popover/recipe-details-popover.page.ts
@@ -4,6 +4,21 @@ import { PreferencesService } from "~/services/preferences.service";
import { RecipeDetailsPreferenceKey } from "@recipesage/util/shared";
import { WakeLockService } from "~/services/wakelock.service";
import { CookingToolbarService } from "~/services/cooking-toolbar.service";
+import type { RecipeSummary, UserPublic } from "@recipesage/prisma";
+
+export type RecipeDetailsPopoverActionTypes =
+ | "delete"
+ | "clone"
+ | "authAndClone"
+ | "addToShoppingList"
+ | "addToMealPlan"
+ | "moveToMain"
+ | "share"
+ | "print"
+ | "pin"
+ | "unpin"
+ | "edit"
+ | "updateWakeLock";
@Component({
selector: "page-recipe-details-popover",
@@ -14,7 +29,15 @@ export class RecipeDetailsPopoverPage {
@Input({
required: true,
})
- recipeId!: string;
+ recipe!: RecipeSummary;
+ @Input({
+ required: true,
+ })
+ me: UserPublic | null = null;
+ @Input({
+ required: true,
+ })
+ isLoggedIn!: boolean;
preferences = this.preferencesService.preferences;
preferenceKeys = RecipeDetailsPreferenceKey;
@@ -34,7 +57,7 @@ export class RecipeDetailsPopoverPage {
this.preferencesService.save();
}
- closeWithAction(name: string) {
+ closeWithAction(name: RecipeDetailsPopoverActionTypes) {
this.popoverCtrl.dismiss({
action: name,
});
diff --git a/packages/frontend/src/app/pages/recipe-components/recipe/recipe.page.html b/packages/frontend/src/app/pages/recipe-components/recipe/recipe.page.html
index f190fce32..fdbc24668 100644
--- a/packages/frontend/src/app/pages/recipe-components/recipe/recipe.page.html
+++ b/packages/frontend/src/app/pages/recipe-components/recipe/recipe.page.html
@@ -307,7 +307,17 @@ {{ recipe.title }}
-
+
+
+
+
+ {{ 'pages.recipeDetails.inInbox' | translate }}
+
+
+
@@ -326,10 +336,7 @@ {{ recipe.title }}
-
+
@@ -343,10 +350,7 @@
{{ recipe.title }}
-
+
@@ -376,7 +380,7 @@
{{ recipe.title }}
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 fc2f2fa11..3d01334e5 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
@@ -31,7 +31,10 @@ import { RecipeCompletionTrackerService } from "~/services/recipe-completion-tra
import { AddRecipeToShoppingListModalPage } from "../add-recipe-to-shopping-list-modal/add-recipe-to-shopping-list-modal.page";
import { AddRecipeToMealPlanModalPage } from "../add-recipe-to-meal-plan-modal/add-recipe-to-meal-plan-modal.page";
import { PrintRecipeModalPage } from "../print-recipe-modal/print-recipe-modal.page";
-import { RecipeDetailsPopoverPage } from "../recipe-details-popover/recipe-details-popover.page";
+import {
+ RecipeDetailsPopoverPage,
+ type RecipeDetailsPopoverActionTypes,
+} from "../recipe-details-popover/recipe-details-popover.page";
import { ShareModalPage } from "~/pages/share-modal/share-modal.page";
import { AuthPage } from "~/pages/auth/auth.page";
import { ImageViewerComponent } from "~/modals/image-viewer/image-viewer.component";
@@ -235,7 +238,9 @@ export class RecipePage {
const popover = await this.popoverCtrl.create({
component: RecipeDetailsPopoverPage,
componentProps: {
- recipeId: this.recipeId,
+ recipe: this.recipe,
+ me: this.me,
+ isLoggedIn: this.isLoggedIn,
},
event,
});
@@ -244,41 +249,39 @@ export class RecipePage {
const { data } = await popover.onWillDismiss();
if (!data || !data.action) return;
- switch (data.action) {
+ const action = data.action as RecipeDetailsPopoverActionTypes;
+ switch (action) {
case "updateWakeLock":
const wlEnabled =
this.preferencesService.preferences[
RecipeDetailsPreferenceKey.EnableWakeLock
];
- wlEnabled ? this.setupWakeLock() : this.releaseWakeLock();
- break;
+ return wlEnabled ? this.setupWakeLock() : this.releaseWakeLock();
case "addToShoppingList":
- this.addRecipeToShoppingList();
- break;
+ return this.addRecipeToShoppingList();
case "addToMealPlan":
- this.addRecipeToMealPlan();
- break;
+ return this.addRecipeToMealPlan();
case "share":
- this.shareRecipe();
- break;
+ return this.shareRecipe();
case "print":
- this.printRecipe();
- break;
+ return this.printRecipe();
case "unpin":
- this.unpinRecipe();
- break;
+ return this.unpinRecipe();
case "pin":
- this.pinRecipe();
- break;
+ return this.pinRecipe();
case "edit":
- this.editRecipe();
- break;
+ return this.editRecipe();
case "clone":
- this.cloneRecipe();
- break;
+ return this.cloneRecipe();
+ case "authAndClone":
+ return this.authAndClone();
+ case "moveToMain":
+ return this.moveToFolder("main");
case "delete":
- this.deleteRecipe();
- break;
+ return this.deleteRecipe();
+ default:
+ const exhaustiveCheck: never = action;
+ throw new Error(`Unhandled action case: ${exhaustiveCheck}`);
}
}
diff --git a/packages/frontend/src/assets/i18n/en-us.json b/packages/frontend/src/assets/i18n/en-us.json
index 48ed0ea9a..adf158eeb 100644
--- a/packages/frontend/src/assets/i18n/en-us.json
+++ b/packages/frontend/src/assets/i18n/en-us.json
@@ -180,6 +180,7 @@
"pages.recipeDetails.labels.uncatLabels": "General",
"pages.recipeDetails.created": "Created",
"pages.recipeDetails.updated": "Last edited",
+ "pages.recipeDetails.inInbox": "This recipe is in your inbox, shared to you by another user.",
"pages.recipeDetails.saveToMyRecipes": "Save This Recipe to My Recipes",
"pages.recipeDetails.delete": "Delete",
"pages.recipeDetails.doesNotBelongToYou": "This recipe does not belong to you yet.",
@@ -212,6 +213,8 @@
"pages.recipeDetailsPopover.makeACopy": "Make a Copy",
"pages.recipeDetailsPopover.dangerZone": "Danger Zone",
"pages.recipeDetailsPopover.delete": "Delete Recipe",
+ "pages.recipeDetailsPopover.registerOrLoginToSave": "Register/Login",
+ "pages.recipeDetailsPopover.saveToMyRecipes": "Save to My Recipes",
"pages.rselectpopover.resetAll": "Reset All",
"pages.rselectpopover.done": "Done",