feat: locale-based generation, describe field for batch cooking; fix bulk-bar width and sourceUrl not saving
- AI recipe generation always used the app's own locale rather than a separate language picker — removed the picker, generation and the saved recipe's language now both follow useLocale() directly. - Bulk-select action bar had an ungated max-w-md that capped it at 448px even past the sm: breakpoint where sm:w-auto was supposed to let it grow to content — added sm:max-w-none so desktop never scrolls. - Batch-cooking generation had no free-text "describe" field like the standard recipe generator does — added one (BatchCookFields, both the standalone dialog and the AI dialog's batch tab), threaded through the API route and generateBatchCook's prompt as additional guidance. - Recipes imported from a URL never actually got their sourceUrl persisted — CreateRecipeSchema didn't declare the field, so Zod silently stripped it before it ever reached the insert. The detail page's "Source: <hostname>" link already existed but was dead code for every real import until now. Verified all 4 live: generate dialog has no language selector, batch tab has a working describe textarea, bulk-select bar renders at full content width with zero horizontal overflow on desktop, and a recipe created with sourceUrl now round-trips and renders its source link.
This commit is contained in:
@@ -15,6 +15,7 @@ const Schema = z.object({
|
||||
servings: z.number().int().min(1).max(12).default(4),
|
||||
dietaryPrefs: z.string().max(200).optional(),
|
||||
difficulty: z.enum(["easy", "medium", "hard"]).optional(),
|
||||
description: z.string().max(500).optional(),
|
||||
});
|
||||
|
||||
export async function POST(req: NextRequest) {
|
||||
@@ -50,6 +51,7 @@ export async function POST(req: NextRequest) {
|
||||
servings: parsed.data.servings,
|
||||
dietaryPrefs: parsed.data.dietaryPrefs,
|
||||
difficulty: parsed.data.difficulty,
|
||||
description: parsed.data.description,
|
||||
},
|
||||
{ ...config, userContext: privateBio ?? undefined },
|
||||
locale
|
||||
|
||||
@@ -19,6 +19,7 @@ const CreateRecipeSchema = z.object({
|
||||
tags: z.array(z.string().min(1).max(50)).max(20).default([]),
|
||||
aiGenerated: z.boolean().optional(),
|
||||
language: z.string().max(10).optional(),
|
||||
sourceUrl: z.string().url().max(2000).optional(),
|
||||
dietaryTags: z.object({
|
||||
vegan: z.boolean().optional(),
|
||||
vegetarian: z.boolean().optional(),
|
||||
@@ -120,6 +121,7 @@ export async function POST(req: NextRequest) {
|
||||
dietaryTags: data.dietaryTags ?? {},
|
||||
aiGenerated: data.aiGenerated ?? false,
|
||||
language: data.language,
|
||||
sourceUrl: data.sourceUrl,
|
||||
isBatchCook: data.isBatchCook,
|
||||
createdAt: now,
|
||||
updatedAt: now,
|
||||
|
||||
Reference in New Issue
Block a user