mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-22 22:43:34 -07:00
convert to script setup
This commit is contained in:
parent
afef06743d
commit
390d91aa83
1 changed files with 51 additions and 65 deletions
|
@ -38,39 +38,31 @@
|
||||||
</v-container>
|
</v-container>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts" setup>
|
||||||
import type { MealsByDate } from "./types";
|
import type { MealsByDate } from "./types";
|
||||||
import type { ReadPlanEntry } from "~/lib/api/types/meal-plan";
|
import type { ReadPlanEntry } from "~/lib/api/types/meal-plan";
|
||||||
import GroupMealPlanDayContextMenu from "~/components/Domain/Household/GroupMealPlanDayContextMenu.vue";
|
import GroupMealPlanDayContextMenu from "~/components/Domain/Household/GroupMealPlanDayContextMenu.vue";
|
||||||
import RecipeCardMobile from "~/components/Domain/Recipe/RecipeCardMobile.vue";
|
import RecipeCardMobile from "~/components/Domain/Recipe/RecipeCardMobile.vue";
|
||||||
import type { RecipeSummary } from "~/lib/api/types/recipe";
|
import type { RecipeSummary } from "~/lib/api/types/recipe";
|
||||||
|
|
||||||
export default defineNuxtComponent({
|
const props = defineProps<{
|
||||||
components: {
|
mealplans: MealsByDate[];
|
||||||
GroupMealPlanDayContextMenu,
|
}>();
|
||||||
RecipeCardMobile,
|
|
||||||
},
|
type DaySection = {
|
||||||
props: {
|
|
||||||
mealplans: {
|
|
||||||
type: Array as () => MealsByDate[],
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
setup(props) {
|
|
||||||
type DaySection = {
|
|
||||||
title: string;
|
title: string;
|
||||||
meals: ReadPlanEntry[];
|
meals: ReadPlanEntry[];
|
||||||
};
|
};
|
||||||
|
|
||||||
type Days = {
|
type Days = {
|
||||||
date: Date;
|
date: Date;
|
||||||
sections: DaySection[];
|
sections: DaySection[];
|
||||||
recipes: RecipeSummary[];
|
recipes: RecipeSummary[];
|
||||||
};
|
};
|
||||||
|
|
||||||
const i18n = useI18n();
|
const i18n = useI18n();
|
||||||
|
|
||||||
const plan = computed<Days[]>(() => {
|
const plan = computed<Days[]>(() => {
|
||||||
return props.mealplans.reduce((acc, day) => {
|
return props.mealplans.reduce((acc, day) => {
|
||||||
const out: Days = {
|
const out: Days = {
|
||||||
date: day.date,
|
date: day.date,
|
||||||
|
@ -109,11 +101,5 @@ export default defineNuxtComponent({
|
||||||
|
|
||||||
return acc;
|
return acc;
|
||||||
}, [] as Days[]);
|
}, [] as Days[]);
|
||||||
});
|
|
||||||
|
|
||||||
return {
|
|
||||||
plan,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue