mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-23 07:09:41 +02:00
feat: Recipe Finder (aka Cocktail Builder) (#4542)
This commit is contained in:
parent
d26e29d1c5
commit
4e0cf985bc
28 changed files with 1959 additions and 151 deletions
|
@ -1,6 +1,7 @@
|
|||
import { Ref, useContext } from "@nuxtjs/composition-api";
|
||||
import { useLocalStorage, useSessionStorage } from "@vueuse/core";
|
||||
import { RegisteredParser, TimelineEventType } from "~/lib/api/types/recipe";
|
||||
import { QueryFilterJSON } from "~/lib/api/types/response";
|
||||
|
||||
export interface UserPrintPreferences {
|
||||
imagePosition: string;
|
||||
|
@ -49,6 +50,17 @@ export interface UserCookbooksPreferences {
|
|||
hideOtherHouseholds: boolean;
|
||||
}
|
||||
|
||||
export interface UserRecipeFinderPreferences {
|
||||
foodIds: string[];
|
||||
toolIds: string[];
|
||||
queryFilter: string;
|
||||
queryFilterJSON: QueryFilterJSON;
|
||||
maxMissingFoods: number;
|
||||
maxMissingTools: number;
|
||||
includeFoodsOnHand: boolean;
|
||||
includeToolsOnHand: boolean;
|
||||
}
|
||||
|
||||
export function useUserMealPlanPreferences(): Ref<UserMealPlanPreferences> {
|
||||
const fromStorage = useLocalStorage(
|
||||
"meal-planner-preferences",
|
||||
|
@ -171,3 +183,24 @@ export function useCookbookPreferences(): Ref<UserCookbooksPreferences> {
|
|||
|
||||
return fromStorage;
|
||||
}
|
||||
|
||||
export function useRecipeFinderPreferences(): Ref<UserRecipeFinderPreferences> {
|
||||
const fromStorage = useLocalStorage(
|
||||
"recipe-finder-preferences",
|
||||
{
|
||||
foodIds: [],
|
||||
toolIds: [],
|
||||
queryFilter: "",
|
||||
queryFilterJSON: { parts: [] } as QueryFilterJSON,
|
||||
maxMissingFoods: 20,
|
||||
maxMissingTools: 20,
|
||||
includeFoodsOnHand: true,
|
||||
includeToolsOnHand: true,
|
||||
},
|
||||
{ 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<UserRecipeFinderPreferences>;
|
||||
|
||||
return fromStorage;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue