fix(planner): address all PR review blockers

- Fix logic bug `{#if !isPlanner === false}` - view/cook buttons now visible for all roles, swap only for planner
- Convert Tauschen from dead button to link with suggestions href
- Add week.ts unit tests (23 tests covering getWeekStart Sunday edge case, prevWeek/nextWeek, weekDays, isToday, formatWeekRange)
- Fix isToday to use UTC consistently (.toISOString().slice(0,10)) instead of local date
- Add server-side role guard to createPlan action (403 for members)
- Add weekStart format validation in createPlan action
- Add isSelected prop to DayMealCard with green treatment
- Make variety banner sticky on mobile (always visible per spec)
- Add day name abbreviation above date badge in desktop column headers
- Remove placeholder Navigation text from desktop sidebar
- Add aria-label to desktop empty tile buttons
- Add variety score partial failure test, multiple overlaps test, WeekStrip today+selected test

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-03 11:07:47 +02:00
parent e3f8d8ad73
commit 5d2bb9e84e
9 changed files with 336 additions and 59 deletions

View File

@@ -15,10 +15,12 @@
let {
slot,
isToday = false,
isSelected = false,
readonly = false
}: {
slot: Slot;
isToday?: boolean;
isSelected?: boolean;
readonly?: boolean;
} = $props();
@@ -30,13 +32,21 @@
.filter(Boolean)
.join(' · ')
);
let borderClass = $derived(
isToday
? 'border-[var(--yellow)] bg-[var(--yellow-tint)]'
: isSelected
? 'border-[var(--green)] bg-[var(--green-tint)]'
: 'border-[var(--color-border)] bg-[var(--color-surface)]'
);
</script>
<div
data-testid="day-meal-card"
data-today={isToday}
class="rounded-[var(--radius-lg)] border-2 p-4 transition-colors
{isToday ? 'border-[var(--yellow)] bg-[var(--yellow-tint)]' : 'border-[var(--color-border)] bg-[var(--color-surface)]'}"
data-selected={isSelected}
class="rounded-[var(--radius-lg)] border-2 p-4 transition-colors {borderClass}"
>
{#if slot.recipe}
<h3 class="font-[var(--font-display)] text-[20px] font-[300] leading-tight text-[var(--color-text)]">
@@ -54,19 +64,19 @@
>
Jetzt kochen
</a>
<button
type="button"
<a
href="/planner/suggestions?day={slot.slotDate}"
class="rounded-[var(--radius-md)] border border-[var(--color-border)] px-3 py-2 text-[13px] font-medium tracking-[0.04em] font-[var(--font-sans)] text-[var(--color-text)]"
>
Tauschen
</button>
</a>
</div>
{/if}
{:else}
<p class="font-[var(--font-sans)] text-[14px] text-[var(--color-text-muted)]">Kein Gericht geplant</p>
{#if !readonly}
<a
href="/planner/suggestions"
href="/planner/suggestions?day={slot.slotDate}"
class="mt-2 inline-block rounded-[var(--radius-md)] border border-dashed border-[var(--color-border)] px-3 py-2 text-[13px] font-medium tracking-[0.04em] font-[var(--font-sans)] text-[var(--color-text-muted)]"
>
+ Gericht hinzufügen