diff --git a/frontend/composables/use-users/preferences.ts b/frontend/composables/use-users/preferences.ts index 52a4d26fdfa6..da25f9d4ff09 100644 --- a/frontend/composables/use-users/preferences.ts +++ b/frontend/composables/use-users/preferences.ts @@ -18,6 +18,10 @@ export enum ImagePosition { right = "right", } +export interface UserMealPlanPreferences { + numberOfDays: number; +} + export interface UserRecipePreferences { orderBy: string; orderDirection: string; @@ -40,6 +44,20 @@ export interface UserParsingPreferences { parser: RegisteredParser; } +export function useUserMealPlanPreferences(): Ref { + const fromStorage = useLocalStorage( + "meal-planner-preferences", + { + numberOfDays: 7, + }, + { mergeDefaults: true } + // we cast to a Ref because by default it will return an optional type ref + // but since we pass defaults we know all properties are set. + ) as unknown as Ref; + + return fromStorage; +} + export function useUserPrintPreferences(): Ref { const fromStorage = useLocalStorage( "recipe-print-preferences", diff --git a/frontend/lang/messages/en-US.json b/frontend/lang/messages/en-US.json index 8d1a906cb15f..77e70a4a6f65 100644 --- a/frontend/lang/messages/en-US.json +++ b/frontend/lang/messages/en-US.json @@ -291,6 +291,8 @@ "mealplan-updated": "Mealplan Updated", "no-meal-plan-defined-yet": "No meal plan defined yet", "no-meal-planned-for-today": "No meal planned for today", + "numberOfDays-hint": "Number of days on page load", + "numberOfDays-label": "Default Days", "only-recipes-with-these-categories-will-be-used-in-meal-plans": "Only recipes with these categories will be used in Meal Plans", "planner": "Planner", "quick-week": "Quick Week", diff --git a/frontend/pages/group/mealplan/planner.vue b/frontend/pages/group/mealplan/planner.vue index 8db3cd54c73d..64b039a52fcf 100644 --- a/frontend/pages/group/mealplan/planner.vue +++ b/frontend/pages/group/mealplan/planner.vue @@ -23,6 +23,13 @@ :first-day-of-week="firstDayOfWeek" :local="$i18n.locale" > + {{ $t("general.ok") }} @@ -47,10 +54,11 @@