feat(recipes): image upload, fix save 500, HelloFresh seed data #53

Merged
marcel merged 50 commits from feat/issue-46-wire-suggestions-recipe-picker into master 2026-04-10 10:18:10 +02:00
Showing only changes of commit ab66269131 - Show all commits

View File

@@ -63,6 +63,15 @@
let swapSheetOpen = $state(false);
let swapLoading = $state(false);
const activePickerDate = $derived(
pickerOpen ? selectedDay
: panelState.kind === 'recipe-picker' ? panelState.date
: null
);
let suggestions: any[] = $state([]);
let isLoadingSuggestions = $state(false);
// Recipes already in any slot this week — used for ⚠ overlap warnings
let currentWeekRecipeIds = $derived(
new Set<string>(slots.filter((s: any) => s.recipe?.id).map((s: any) => s.recipe.id))
@@ -91,6 +100,20 @@
let undoVisible = $state(false);
let undoMessage = $state('');
$effect(() => {
if (!activePickerDate || !weekPlan?.id) {
suggestions = [];
isLoadingSuggestions = false;
return;
}
isLoadingSuggestions = true;
fetch(`/planner?planId=${weekPlan.id}&date=${activePickerDate}`)
.then((r) => r.json())
.then((d) => { suggestions = d.suggestions ?? []; })
.catch(() => { suggestions = []; })
.finally(() => { isLoadingSuggestions = false; });
});
function handleSelectDay(day: string) {
selectedDay = day;
panelState = { kind: 'day-detail', date: day };
@@ -282,9 +305,9 @@
planId={weekPlan?.id ?? ''}
date={selectedDay}
dateLabel={formatDayLabel(selectedDay)}
currentVarietyScore={varietyScore?.score ?? 0}
suggestions={[]}
suggestions={suggestions}
allRecipes={data.recipes}
isLoading={isLoadingSuggestions}
onpick={handleRecipePick}
/>
</BottomSheet>
@@ -560,9 +583,9 @@
planId={weekPlan?.id ?? ''}
date={pickerDate}
dateLabel={formatDayLabel(pickerDate)}
currentVarietyScore={varietyScore?.score ?? 0}
suggestions={[]}
suggestions={suggestions}
allRecipes={data.recipes}
isLoading={isLoadingSuggestions}
onpick={handleRecipePick}
/>
</div>