werkstaetten-app/src/routes/(app)/+page.svelte
Friederich Loheide bef8574e07 Werkstatt-App: öffentliche PWA und Redaktions-Backend
Werbefreie, barrierearme Info-App für Werkstätten (WfbM) auf Basis von
SvelteKit, Tailwind, SQLite/Drizzle:

- App: Startseite mit Kacheln, Meldungen, Seitenbaum, Termine inkl.
  Schließzeiten und iCal-Abo, Ansprechpartner, Suche, Kontaktformular,
  Merkliste, Vorlesen, Leichte Sprache, Schriftgrößen, Hell/Dunkel, PWA
- Redaktion: Dashboard, Meldungen, Seiten, Termine, Kacheln,
  Ansprechpartner, Mediathek mit Bildoptimierung, Postfach, Benutzer
  mit Rollen, Einstellungen (Name, Logo, Farbe, Rechtstexte)
- Demo-Seed, CLI zum Anlegen von Benutzern, Dockerfile und Compose

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-29 20:55:13 +00:00

102 lines
4 KiB
Svelte

<script lang="ts">
import ArrowRight from '@lucide/svelte/icons/arrow-right';
import Search from '@lucide/svelte/icons/search';
import DoorClosed from '@lucide/svelte/icons/door-closed';
import Tile from '$lib/components/Tile.svelte';
import PostCard from '$lib/components/PostCard.svelte';
import EventRow from '$lib/components/EventRow.svelte';
import { formatLong, eventWhen, TZ } from '$lib/dates';
let { data } = $props();
const hour = Number(new Intl.DateTimeFormat('de-DE', { hour: 'numeric', hour12: false, timeZone: TZ }).format(new Date()));
const daytime = hour < 11 ? 'Guten Morgen' : hour < 17 ? 'Hallo' : 'Guten Abend';
</script>
<svelte:head>
<title>{data.brand.appName}</title>
</svelte:head>
<div class="space-y-10">
<!-- Begrüßung -->
<section class="relative overflow-hidden rounded-[1.75rem] bg-brand text-white px-6 pt-7 pb-6 shadow-float">
<div aria-hidden="true" class="absolute -right-16 -top-20 size-64 rounded-full bg-white/10"></div>
<div aria-hidden="true" class="absolute right-10 -bottom-24 size-48 rounded-full bg-white/[0.07]"></div>
<div class="relative">
<p class="text-white/80 font-semibold">{daytime}!</p>
<h1 class="font-display text-[1.9rem] sm:text-4xl font-extrabold mt-1 max-w-xl">{data.greeting}</h1>
{#if data.intro}<p class="mt-3 text-white/85 max-w-xl">{data.intro}</p>{/if}
<form action="/suche" class="mt-5 max-w-xl" role="search">
<label class="flex items-center gap-2 rounded-2xl bg-white text-ink pl-4 pr-1.5 h-13 shadow-card">
<Search class="size-5 text-ink-3 shrink-0" />
<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 placeholder:text-ink-3" />
<button class="btn btn-primary btn-sm">Suchen</button>
</label>
</form>
</div>
</section>
{#each data.closures as c (c.id)}
<a href="/termine" class="tone-amber bg-tone-soft text-tone-ink rounded-2xl p-4 flex items-center gap-4 -mt-4">
<span class="grid place-items-center size-11 rounded-xl bg-tone text-white shrink-0"><DoorClosed class="size-5" /></span>
<span>
<span class="block font-bold">{c.title}</span>
<span class="block text-sm">{c.endDate && c.endDate !== c.startDate ? eventWhen(c) : formatLong(c.startDate)}</span>
</span>
</a>
{/each}
<!-- Kacheln -->
{#if data.tiles.length}
<section aria-labelledby="bereiche">
<h2 id="bereiche" class="sr-only">Bereiche</h2>
<div class="grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3">
{#each data.tiles as t (t.id)}
<Tile href={t.href} label={t.label} icon={t.icon} color={t.color} />
{/each}
</div>
</section>
{/if}
<div class="grid lg:grid-cols-5 gap-10 lg:gap-8">
<!-- Meldungen -->
<section class="lg:col-span-3" aria-labelledby="neu">
<div class="flex items-end justify-between mb-4">
<h2 id="neu" class="font-display text-2xl font-bold">Neuigkeiten</h2>
<a href="/meldungen" class="text-sm font-semibold text-brand-ink inline-flex items-center gap-1 hover:gap-2 transition-all">
Alle <ArrowRight class="size-4" />
</a>
</div>
{#if data.posts.length}
<div class="space-y-3">
<PostCard post={data.posts[0]} variant="hero" />
{#each data.posts.slice(1) as p (p.id)}
<PostCard post={p} />
{/each}
</div>
{:else}
<p class="text-ink-3">Noch keine Meldungen.</p>
{/if}
</section>
<!-- Termine -->
<section class="lg:col-span-2" aria-labelledby="termine">
<div class="flex items-end justify-between mb-4">
<h2 id="termine" class="font-display text-2xl font-bold">Nächste Termine</h2>
<a href="/termine" class="text-sm font-semibold text-brand-ink inline-flex items-center gap-1 hover:gap-2 transition-all">
Kalender <ArrowRight class="size-4" />
</a>
</div>
{#if data.events.length}
<div class="space-y-2.5">
{#each data.events as e (e.id)}
<EventRow event={e} />
{/each}
</div>
{:else}
<p class="text-ink-3">Gerade keine Termine geplant.</p>
{/if}
</section>
</div>
</div>