werkstaetten-app/src/routes/(app)/+page.svelte
Friederich Loheide 07fa837807
Some checks failed
Prüfen / pruefen (pull_request) Failing after 1m8s
Prüfen / pruefen (push) Failing after 1m11s
Speiseplan, Übersetzungen, Statistik, Überwachung, Tests und CI (0.2.0)
- Speiseplan: Wochenansicht mit Linien, Standorten, Kennzeichnung und Allergenen
  (LMIV), „Heute gibt es“ auf der Startseite, Pflege in der Redaktion mit
  „Vorwoche übernehmen“
- Übersetzungen per KI in acht Sprachen für Meldungen und Seiten – gekennzeichnet,
  mit Original-Ansicht, lang/dir für Screenreader und Rechts-nach-links-Satz,
  Vorlesen in der jeweiligen Sprache; Ausgabe wird wie bisher bereinigt
- Statistik: anonyme Aufrufzahlen je Tag/Seite/Web-App/Sprachfassung,
  ohne Cookies und IP-Adressen; Datenschutzvorlage ergänzt und automatisch nummeriert
- Betrieb: /health, Fehlermeldungen an ALERT_EMAIL (gedrosselt), Version in der
  Redaktion, deploy/uebersicht.sh, aktualisieren.sh holt Images aus der Registry
  und prüft jede Einrichtung nach dem Start
- Tests: Vitest (Logik und Server mit Test-Datenbank) und Playwright (Leser mobil,
  Redaktion desktop, KI über Testdienst, axe hell/dunkel)
- Forgejo Actions: Prüfung bei jedem Push, Release-Image bei Versions-Tags
- Barrierefreiheit: Schalter mit role=switch, Logo-Link und Kalender-Einträge
  nennen den sichtbaren Text zuerst (WCAG 2.5.3)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-09 19:01:41 +00:00

167 lines
7.4 KiB
Svelte
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<script lang="ts">
import ArrowRight from '@lucide/svelte/icons/arrow-right';
import Search from '@lucide/svelte/icons/search';
import CalendarPlus from '@lucide/svelte/icons/calendar-plus';
import HomeHero from '$lib/components/HomeHero.svelte';
import HeroKlar from '$lib/components/HeroKlar.svelte';
import HeroKacheln from '$lib/components/HeroKacheln.svelte';
import EventRow from '$lib/components/EventRow.svelte';
import { TILE_GRID } from '$lib/theme';
import Tile from '$lib/components/Tile.svelte';
import PostCard from '$lib/components/PostCard.svelte';
import MealCard from '$lib/components/MealCard.svelte';
import Utensils from '@lucide/svelte/icons/utensils';
import { dayOfMonth, eventWhen, formatLong, monthAbbr, weekday } from '$lib/dates';
let { data } = $props();
const preset = $derived(data.brand.theme.preset);
</script>
<svelte:head>
<title>{data.brand.appName}</title>
</svelte:head>
<div class="space-y-14 lg:space-y-20">
<!-- Kopfbereich je Design-Vorlage -->
{#if preset === 'kacheln'}
<HeroKacheln image={data.heroEnabled ? data.hero : null} headline={data.greeting} intro={data.intro} org={data.brand.orgName} highlight={data.highlight} />
{:else if !data.heroEnabled}
<h1 class="font-bold text-3xl sm:text-4xl text-brand-ink pt-4">{data.greeting}</h1>
{:else if preset === 'klar'}
<HeroKlar image={data.hero} headline={data.greeting} org={data.brand.orgName} highlight={data.highlight} />
{:else}
<HomeHero image={data.hero} headline={data.greeting} tagline={data.heroTagline} highlight={data.highlight} />
{/if}
<!-- Einleitung & Suche (bei „Kacheln“ steckt beides im Kopfbereich) -->
{#if preset !== 'kacheln'}
<section class="grid lg:grid-cols-2 gap-6 lg:gap-16 items-end [&>*]:min-w-0">
<div class="space-y-3">
<p class="eyebrow eyebrow-rule">{data.brand.orgName}</p>
{#if data.intro}<p class="text-lg text-ink-2 max-w-xl">{data.intro}</p>{/if}
</div>
<form action="/suche" role="search">
<label class="flex items-center gap-3 rounded-pill bg-surface-2 pl-5 pr-1.5 h-15 focus-within:ring-4 focus-within:ring-brand/15 transition">
<Search class="size-5 text-brand-ink shrink-0" strokeWidth={2.4} />
<span class="sr-only">Suchen</span>
<input name="q" type="search" placeholder="Was suchst du?" class="flex-1 min-w-0 bg-transparent outline-none h-full font-semibold placeholder:text-ink-3 placeholder:font-medium" />
<button class="btn btn-primary">Suchen</button>
</label>
</form>
</section>
{/if}
<!-- Bereiche -->
{#if data.tiles.length}
<section aria-labelledby="bereiche" class="space-y-5">
<div class="space-y-2">
<p class="eyebrow eyebrow-rule">Bereiche</p>
<h2 id="bereiche" class="text-2xl sm:text-3xl text-brand-ink">Was möchtest du wissen?</h2>
</div>
<div class={TILE_GRID[preset]}>
{#each data.tiles as t (t.id)}
<Tile href={t.href} label={t.label} icon={t.icon} />
{/each}
</div>
</section>
{/if}
<!-- Essen -->
{#if data.meals}
<section aria-labelledby="essen" class="space-y-5">
<div class="flex items-end justify-between gap-4">
<div class="space-y-2">
<p class="eyebrow eyebrow-rule">Speiseplan</p>
<h2 id="essen" class="text-2xl sm:text-3xl text-brand-ink">{data.meals.isToday ? 'Heute gibt es' : `Am ${formatLong(data.meals.date).split(',')[0]} gibt es`}</h2>
</div>
<a href="/speiseplan" class="btn btn-soft btn-sm shrink-0">Ganze Woche <ArrowRight class="size-4" /></a>
</div>
<div class="card p-5 sm:p-6 flex gap-5">
<span class="hidden sm:grid place-items-center size-12 rounded-full bg-brand-soft text-brand-ink shrink-0" aria-hidden="true"><Utensils class="size-6" /></span>
<ul class="flex-1 grid md:grid-cols-3 gap-5">
{#each data.meals.items as m (m.id)}<li><MealCard meal={m} /></li>{/each}
</ul>
</div>
{#if data.meals.more}<p class="hint">und {data.meals.more} weitere – siehe Speiseplan.</p>{/if}
</section>
{/if}
<!-- Neuigkeiten -->
<section aria-labelledby="neu" class="space-y-5">
<div class="flex items-end justify-between gap-4">
<div class="space-y-2">
<p class="eyebrow eyebrow-rule">Aktuelles</p>
<h2 id="neu" class="text-2xl sm:text-3xl text-brand-ink">Neuigkeiten</h2>
</div>
<a href="/meldungen" class="btn btn-soft btn-sm shrink-0">Alle <ArrowRight class="size-4" /></a>
</div>
{#if data.posts.length}
<div class="grid md:grid-cols-2 lg:grid-cols-3 gap-x-6 gap-y-8">
{#each data.posts as p (p.id)}
<PostCard post={p} />
{/each}
</div>
{:else}
<p class="text-ink-3">Noch keine Meldungen.</p>
{/if}
</section>
{#if preset !== 'kreis'}
<!-- Termine als Liste -->
<section aria-labelledby="termine" class="space-y-5">
<div class="flex items-end justify-between gap-4">
<div class="space-y-2">
<p class="eyebrow eyebrow-rule">Termine</p>
<h2 id="termine" class="text-2xl sm:text-3xl text-brand-ink">Was steht an?</h2>
</div>
<a href="/termine" class="btn btn-soft btn-sm shrink-0">Alle <ArrowRight class="size-4" /></a>
</div>
{#if data.events.length}
<div class="grid lg:grid-cols-2 gap-x-6 divide-y divide-line lg:divide-y-0">
{#each data.events as e (e.id)}<EventRow event={e} />{/each}
</div>
{:else}
<p class="text-ink-3">Gerade sind keine Termine geplant.</p>
{/if}
<a href="/termine.ics" class="btn btn-ghost btn-sm"><CalendarPlus class="size-4" />Kalender abonnieren</a>
</section>
{:else}
<!-- Termine als Farbblock -->
<section aria-labelledby="termine" class="relative -mx-4 lg:mx-0 lg:rounded-3xl overflow-hidden bg-brand text-on-brand">
<div aria-hidden="true" class="absolute -right-32 -bottom-40 size-[26rem] rounded-full bg-accent"></div>
<div class="relative px-5 py-10 sm:px-8 lg:px-12 lg:py-14 grid lg:grid-cols-[1fr_1.4fr] gap-8 lg:gap-14">
<div class="space-y-4">
<p class="eyebrow text-on-brand/70">Termine</p>
<h2 id="termine" class="text-3xl sm:text-4xl">Was steht an?</h2>
<p class="text-on-brand/80 max-w-sm">Veranstaltungen, Versammlungen und Schließzeiten auf einen Blick.</p>
<div class="flex flex-wrap gap-2 pt-2">
<a href="/termine" class="btn bg-white text-brand hover:bg-white/90">Alle Termine</a>
<a href="/termine.ics" class="btn text-on-brand hover:bg-white/10"><CalendarPlus class="size-4" />Kalender abonnieren</a>
</div>
</div>
{#if data.events.length}
<ul class="divide-y divide-white/15 border-y border-white/15">
{#each data.events as e (e.id)}
<li class="flex items-center gap-5 py-4">
<span class="w-14 shrink-0 text-center leading-none" aria-hidden="true">
<span class="block text-[0.7rem] font-semibold uppercase tracking-[0.15em] text-on-brand/70">{weekday(e.startDate)}</span>
<span class="block text-3xl font-bold my-1">{dayOfMonth(e.startDate)}</span>
<span class="block text-xs font-semibold uppercase tracking-wider text-on-brand/70">{monthAbbr(e.startDate)}</span>
</span>
<span class="min-w-0">
{#if e.kind === 'closure'}
<span class="inline-block rounded-pill bg-accent px-2.5 py-0.5 text-[0.7rem] font-bold uppercase tracking-wider mb-1">Geschlossen</span>
{/if}
<span class="block font-bold text-lg leading-snug">{e.title}</span>
<span class="block text-sm text-on-brand/75">{eventWhen(e)}{e.location ? ` · ${e.location}` : ''}</span>
</span>
</li>
{/each}
</ul>
{:else}
<p class="text-on-brand/80 self-center">Gerade sind keine Termine geplant.</p>
{/if}
</div>
</section>
{/if}
</div>