fix(frontend): address all PR review concerns

- Fix 7px → 11px font-size on section headers in RecipePicker
- Extract shared slotActions.ts with UUID validation for planId/slotId/recipeId
- Load full recipe list in planner page load (was placeholder current-week slots)
- Update planner/+page.svelte to pass data.recipes as allRecipes to RecipePicker
- Update planner and recipes page.server.ts to use shared slot action helpers
- Fix planner page.server tests: add recipes mock for parallel GET load
- Update action tests to use valid UUIDs (were 'plan-1'/'r1' style strings)
- Add validation-path tests for blank/invalid input on all slot actions
- Add tests for recipes/+server.ts GET endpoint (DayPicker week navigation)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-09 08:19:37 +02:00
parent ea7113ec53
commit e5d96cd85a
8 changed files with 396 additions and 185 deletions

View File

@@ -10,7 +10,7 @@
import UndoBar from '$lib/planner/UndoBar.svelte';
import { prevWeek, nextWeek, getWeekStart, weekDays, formatDayLabel, formatDayAbbr, formatWeekRange } from '$lib/planner/week';
let { data, form = null }: { data: { weekPlan: any; varietyScore: any; weekStart: string }; form?: any } = $props();
let { data, form = null }: { data: { weekPlan: any; varietyScore: any; weekStart: string; recipes: any[] }; form?: any } = $props();
// Use UTC date string (YYYY-MM-DD) consistently
const today: string = new Date().toISOString().slice(0, 10);
@@ -263,7 +263,7 @@
dateLabel={formatDayLabel(selectedDay)}
currentVarietyScore={varietyScore?.score ?? 0}
suggestions={[]}
allRecipes={weekPlan?.slots?.map((s: any) => s.recipe).filter(Boolean) ?? []}
allRecipes={data.recipes}
onpick={handleRecipePick}
/>
</BottomSheet>
@@ -495,7 +495,7 @@
dateLabel={formatDayLabel(pickerDate)}
currentVarietyScore={varietyScore?.score ?? 0}
suggestions={[]}
allRecipes={weekPlan?.slots?.map((s: any) => s.recipe).filter(Boolean) ?? []}
allRecipes={data.recipes}
onpick={handleRecipePick}
/>
</div>