diff --git a/src/pages/recipe/[id]/edit.vue b/src/pages/recipe/[id]/edit.vue
index 1469472..6343763 100644
--- a/src/pages/recipe/[id]/edit.vue
+++ b/src/pages/recipe/[id]/edit.vue
@@ -37,8 +37,9 @@ const { t } = useTranslation();
let isDirty = false;
let croppingCanvas: HTMLCanvasElement;
-const id = computed(() => parseInt(route.params.id as string));
const query = computed(() => route.query);
+const id = computed(() => parseInt(route.params.id as string));
+const categoryId = computed(() => parseInt(query.value.categoryId as string ?? "0"));
const item = ref({
id: 0,
title: "",
@@ -49,6 +50,7 @@ const item = ref({
imageAvailable: false,
multiplier: 1,
language: i18next.language,
+ categoryId: categoryId.value,
nutrition: {
servingSize: 0,
totalFat: 0,
@@ -332,6 +334,11 @@ async function importRecipeFromUrl() {
}
item.value.imageAvailable = images.value.length > 0;
+
+ if (editInSingleTextArea.value) {
+ ingredientsText.value = item.value.ingredients.join("\n");
+ stepsText.value = item.value.steps.join("\n");
+ }
}
catch {
isImportFromUrlModalOpen.value = true;
@@ -678,7 +685,7 @@ function changeLanguage() {
diff --git a/src/services/category.ts b/src/services/category.ts
index 54f4ebf..956d8d7 100644
--- a/src/services/category.ts
+++ b/src/services/category.ts
@@ -2,4 +2,5 @@ export class Category {
id!: number;
name!: string;
image!: string | undefined;
+ recipeCount!: number;
}
\ No newline at end of file
diff --git a/src/services/dataService.ts b/src/services/dataService.ts
index 618e95b..04eed42 100644
--- a/src/services/dataService.ts
+++ b/src/services/dataService.ts
@@ -243,7 +243,12 @@ export async function getCategories(): Promise
> {
id: category.id, name: category.name
} as Category;
- const recipe = await db.recipes.where("categoryId").equals(category.id).first();
+ const recipes = db.recipes.where("categoryId").equals(category.id);
+ const count = await recipes.count();
+ const recipe = await recipes.first();
+
+ resultItem.recipeCount = count;
+
if (category.image) {
resultItem.image = category.image;
} else if (recipe) {
@@ -255,7 +260,8 @@ export async function getCategories(): Promise> {
result.push(resultItem);
}
}
- result.push({ id: 0, name: "All", image: undefined });
+ const allRecipesCount = await db.recipes.count();
+ result.push({ id: 0, name: "All", image: undefined, recipeCount: allRecipesCount });
return result;
}