feat: Added Option to Import Recipe Category During Recipe Import (#6523)

Co-authored-by: Michael Genson <genson.michael@gmail.com>
Co-authored-by: Michael Genson <71845777+michael-genson@users.noreply.github.com>
This commit is contained in:
Gtt1229
2026-01-30 12:18:15 -05:00
committed by GitHub
parent e3e45c534e
commit e83891e3ca
11 changed files with 86 additions and 13 deletions

View File

@@ -2,6 +2,7 @@ import { useRecipeCreatePreferences } from "~/composables/use-users/preferences"
export interface UseNewRecipeOptionsProps {
enableImportKeywords?: boolean;
enableImportCategories?: boolean;
enableStayInEditMode?: boolean;
enableParseRecipe?: boolean;
}
@@ -9,6 +10,7 @@ export interface UseNewRecipeOptionsProps {
export function useNewRecipeOptions(props: UseNewRecipeOptionsProps = {}) {
const {
enableImportKeywords = true,
enableImportCategories = true,
enableStayInEditMode = true,
enableParseRecipe = true,
} = props;
@@ -27,6 +29,17 @@ export function useNewRecipeOptions(props: UseNewRecipeOptionsProps = {}) {
},
});
const importCategories = computed({
get() {
if (!enableImportCategories) return false;
return recipeCreatePreferences.value.importCategories;
},
set(v: boolean) {
if (!enableImportCategories) return;
recipeCreatePreferences.value.importCategories = v;
},
});
const stayInEditMode = computed({
get() {
if (!enableStayInEditMode) return false;
@@ -71,6 +84,7 @@ export function useNewRecipeOptions(props: UseNewRecipeOptionsProps = {}) {
return {
// Computed properties for the checkboxes
importKeywordsAsTags,
importCategories,
stayInEditMode,
parseRecipe,
@@ -79,6 +93,7 @@ export function useNewRecipeOptions(props: UseNewRecipeOptionsProps = {}) {
// Props for conditional rendering
enableImportKeywords,
enableImportCategories,
enableStayInEditMode,
enableParseRecipe,
};

View File

@@ -63,6 +63,7 @@ export interface UserRecipeFinderPreferences {
export interface UserRecipeCreatePreferences {
importKeywordsAsTags: boolean;
importCategories: boolean;
stayInEditMode: boolean;
parseRecipe: boolean;
}
@@ -233,6 +234,7 @@ export function useRecipeCreatePreferences(): Ref<UserRecipeCreatePreferences> {
"recipe-create-preferences",
{
importKeywordsAsTags: false,
importCategories: false,
stayInEditMode: false,
parseRecipe: true,
},