1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-07-23 07:09:41 +02:00

feat: Set default number of days on meal planner (#3650)

This commit is contained in:
boc-the-git 2024-05-27 07:30:15 +10:00 committed by GitHub
parent af9e0f27a3
commit e3c642debf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 45 additions and 7 deletions

View file

@ -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<UserMealPlanPreferences> {
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<UserMealPlanPreferences>;
return fromStorage;
}
export function useUserPrintPreferences(): Ref<UserPrintPreferences> {
const fromStorage = useLocalStorage(
"recipe-print-preferences",