diff --git a/vue3/src/components/display/HorizontalMealPlanWindow.vue b/vue3/src/components/display/HorizontalMealPlanWindow.vue new file mode 100644 index 000000000..ebd4b5180 --- /dev/null +++ b/vue3/src/components/display/HorizontalMealPlanWindow.vue @@ -0,0 +1,138 @@ + + + + Meal Plans + + + + + + + + + + + + + + + {{ mealPlanGridItem.date_label }} + + + + + + + + + + + + + + + {{ p.recipe.name }} + {{ p.title }} + + + {{ p.mealType.name }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/vue3/src/components/display/HorizontalRecipeScroller.vue b/vue3/src/components/display/HorizontalRecipeWindow.vue similarity index 97% rename from vue3/src/components/display/HorizontalRecipeScroller.vue rename to vue3/src/components/display/HorizontalRecipeWindow.vue index c70814ae1..9451b6486 100644 --- a/vue3/src/components/display/HorizontalRecipeScroller.vue +++ b/vue3/src/components/display/HorizontalRecipeWindow.vue @@ -5,7 +5,7 @@ - + diff --git a/vue3/src/pages/RecipeSearchPage.vue b/vue3/src/pages/RecipeSearchPage.vue index ff7e27f5c..3c5b67f05 100644 --- a/vue3/src/pages/RecipeSearchPage.vue +++ b/vue3/src/pages/RecipeSearchPage.vue @@ -1,49 +1,7 @@ - - - Meal Plan - - - - - - - - {{ day.date_label }} - - - - - - - - - {{ p.recipe.name }} - {{ p.title }} - - - {{ p.mealType.name }} - - - - - - - - - - - - - - - - - - - + @@ -63,14 +21,15 @@ import KeywordsComponent from "@/components/display/KeywordsBar.vue"; import RecipeCardComponent from "@/components/display/RecipeCard.vue"; import GlobalSearchDialog from "@/components/inputs/GlobalSearchDialog.vue"; import RecipeCard from "@/components/display/RecipeCard.vue"; -import HorizontalRecipeScroller from "@/components/display/HorizontalRecipeScroller.vue"; +import HorizontalRecipeScroller from "@/components/display/HorizontalRecipeWindow.vue"; import {DateTime} from "luxon"; import {useMealPlanStore} from "@/stores/MealPlanStore"; +import HorizontalMealPlanWindow from "@/components/display/HorizontalMealPlanWindow.vue"; export default defineComponent({ name: "RecipeSearchPage", - components: {HorizontalRecipeScroller, RecipeCard, GlobalSearchDialog, RecipeCardComponent, KeywordsComponent}, + components: {HorizontalMealPlanWindow, HorizontalRecipeScroller, RecipeCard, GlobalSearchDialog, RecipeCardComponent, KeywordsComponent}, computed: { meal_plan_grid: function () { @@ -106,8 +65,6 @@ export default defineComponent({ mounted() { const api = new ApiApi() - useMealPlanStore().refreshFromAPI(DateTime.now().toJSDate(), DateTime.now().plus({days: 7}).toJSDate()) - api.apiRecipeList({_new: 'true', pageSize: 16}).then(r => { if (r.results != undefined) { // TODO openapi generator makes arrays nullable for some reason this.new_recipes = r.results diff --git a/vue3/src/stores/MealPlanStore.ts b/vue3/src/stores/MealPlanStore.ts index fb070562e..05be9224d 100644 --- a/vue3/src/stores/MealPlanStore.ts +++ b/vue3/src/stores/MealPlanStore.ts @@ -55,13 +55,14 @@ export const useMealPlanStore = defineStore(_STORE_ID, () => { currently_updating.value = [from_date, to_date] // certainly no perfect check but better than nothing const api = new ApiApi() - api.apiMealPlanList({fromDate: DateTime.fromJSDate(from_date).toISODate() as string, toDate: DateTime.fromJSDate(to_date).toISODate() as string}).then(r => { + return api.apiMealPlanList({fromDate: DateTime.fromJSDate(from_date).toISODate() as string, toDate: DateTime.fromJSDate(to_date).toISODate() as string}).then(r => { r.forEach((p) => { plans.value.set(p.id, p) }) currently_updating.value = [new Date(0), new Date(0)] }) } + return new Promise(() => {}) } function createObject(object: MealPlan) {