Startseite: großes Bild über der Begrüßung

Wie bei der Vitus-App zeigt die Startseite oben ein Bild. Es wird in den
Einstellungen gewählt (oder ausgeblendet); ohne eigenes Foto erscheint
eine Platzhalter-Illustration (static/hero-placeholder.svg).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Friederich Loheide 2026-09-30 14:22:47 +00:00
parent bef8574e07
commit 6f706dfa49
6 changed files with 123 additions and 17 deletions

View file

@ -11,6 +11,9 @@ export type AppSettings = {
/** Markenfarbe als Hex-Wert */
brandColor: string;
logoId: number | null;
/** Großes Bild oben auf der Startseite */
heroEnabled: boolean;
heroImageId: number | null;
website: string;
contactEmail: string;
contactIntro: string;
@ -28,6 +31,8 @@ export const DEFAULT_SETTINGS: AppSettings = {
intro: 'Hier findest du Neuigkeiten, Termine und alles Wichtige rund um deine Werkstatt.',
brandColor: '#0e7c66',
logoId: null,
heroEnabled: true,
heroImageId: null,
website: '',
contactEmail: '',
contactIntro: 'Du hast Fragen oder Ideen für die App? Schreib uns gerne!',

View file

@ -1,7 +1,7 @@
import { asc } from 'drizzle-orm';
import { db } from '$lib/server/db';
import { tiles } from '$lib/server/db/schema';
import { listPosts, upcomingEvents } from '$lib/server/content';
import { getMedia, listPosts, upcomingEvents } from '$lib/server/content';
import { getSettings } from '$lib/server/settings';
import { addDays, today } from '$lib/dates';
@ -11,6 +11,9 @@ export const load = () => {
return {
greeting: s.greeting,
intro: s.intro,
heroEnabled: s.heroEnabled,
// Ohne eigenes Bild wird der Platzhalter /hero-placeholder.svg gezeigt
hero: getMedia(s.heroImageId),
tiles: db.select().from(tiles).orderBy(asc(tiles.sortOrder), asc(tiles.id)).all(),
posts: listPosts({ limit: s.homeNewsCount }).items,
events: upcomingEvents({ limit: s.homeEventsCount, kind: 'event' }),

View file

@ -19,21 +19,35 @@
<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>
<section class="overflow-hidden rounded-[1.75rem] bg-brand text-white shadow-float">
{#if data.heroEnabled}
<div class="relative h-44 sm:h-64 lg:h-80">
<img
src={data.hero?.url ?? '/hero-placeholder.svg'}
alt={data.hero?.alt ?? ''}
class="size-full object-cover"
fetchpriority="high"
/>
<!-- weicher Übergang ins Begrüßungsfeld -->
<div aria-hidden="true" class="absolute inset-x-0 bottom-0 h-16 bg-gradient-to-b from-transparent to-brand"></div>
</div>
{/if}
<div class="relative overflow-hidden px-6 pb-6 {data.heroEnabled ? 'pt-2' : 'pt-7'}">
<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>
</div>
</section>

View file

@ -7,7 +7,7 @@ import { cleanHtml } from '$lib/server/sanitize';
export const load = ({ locals }) => {
requireAdmin(locals.user);
const s = getSettings();
return { settings: s, logo: getMedia(s.logoId) };
return { settings: s, logo: getMedia(s.logoId), hero: getMedia(s.heroImageId) };
};
export const actions = {
@ -28,6 +28,8 @@ export const actions = {
intro: f.str('intro', 400),
brandColor,
logoId: f.int('logoId'),
heroEnabled: f.bool('heroEnabled'),
heroImageId: f.int('heroImageId'),
website,
contactEmail: f.str('contactEmail', 200),
contactIntro: f.str('contactIntro', 400),

View file

@ -4,6 +4,7 @@
import Panel from '$lib/admin/Panel.svelte';
import ImageField from '$lib/admin/ImageField.svelte';
import RichEditor from '$lib/admin/RichEditor.svelte';
import Switch from '$lib/admin/Switch.svelte';
let { data } = $props();
const s = $derived(data.settings);
@ -37,6 +38,14 @@
</Panel>
<Panel title="Startseite">
<Switch name="heroEnabled" checked={s.heroEnabled} label="Bild oben anzeigen" hint="Großes Bild über der Begrüßung" />
<div class="max-w-xl">
<ImageField name="heroImageId" value={data.hero} label="Startbild" aspect="aspect-[16/7]" />
<p class="hint">
Am besten ein Foto im Querformat, mindestens 1600 px breit. Solange keins gewählt ist, erscheint eine
Platzhalter-Illustration.
</p>
</div>
<div>
<label class="label" for="greeting">Begrüßung</label>
<input id="greeting" name="greeting" class="field" value={s.greeting} />

View file

@ -0,0 +1,73 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1600 700" preserveAspectRatio="xMidYMid slice">
<!-- Platzhalter für das Startbild. Eigenes Foto: Redaktion → Einstellungen → Startbild -->
<defs>
<linearGradient id="sky" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#cfe9df"/>
<stop offset="1" stop-color="#f6efd9"/>
</linearGradient>
<linearGradient id="hillBack" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#9fcfb5"/>
<stop offset="1" stop-color="#86bfa1"/>
</linearGradient>
<linearGradient id="hillFront" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#4fa37e"/>
<stop offset="1" stop-color="#2f8a66"/>
</linearGradient>
</defs>
<rect width="1600" height="700" fill="url(#sky)"/>
<!-- Sonne -->
<circle cx="1260" cy="170" r="92" fill="#f7cf6b"/>
<circle cx="1260" cy="170" r="140" fill="#f7cf6b" opacity="0.18"/>
<!-- Wolken -->
<g fill="#ffffff" opacity="0.85">
<ellipse cx="330" cy="140" rx="110" ry="30"/>
<ellipse cx="400" cy="120" rx="70" ry="34"/>
<ellipse cx="930" cy="95" rx="80" ry="22"/>
<ellipse cx="975" cy="80" rx="48" ry="24"/>
</g>
<!-- Hügel hinten -->
<path d="M0 470 C 220 380, 420 400, 640 440 S 1100 360, 1320 400 S 1560 430, 1600 420 V700 H0 Z" fill="url(#hillBack)"/>
<!-- Werkstattgebäude mit Sheddach -->
<g transform="translate(560 318)">
<rect x="0" y="92" width="470" height="170" fill="#fbf7ee"/>
<path d="M0 92 L0 40 L94 92 L94 40 L188 92 L188 40 L282 92 L282 40 L376 92 L376 40 L470 92 Z" fill="#e2553a"/>
<path d="M0 40 L0 92 M94 40 L94 92 M188 40 L188 92 M282 40 L282 92 M376 40 L376 92" stroke="#b9432c" stroke-width="6"/>
<g fill="#8fc6e8">
<rect x="34" y="128" width="62" height="46" rx="6"/>
<rect x="126" y="128" width="62" height="46" rx="6"/>
<rect x="282" y="128" width="62" height="46" rx="6"/>
<rect x="374" y="128" width="62" height="46" rx="6"/>
</g>
<rect x="206" y="160" width="58" height="102" rx="8" fill="#d98a06"/>
<circle cx="252" cy="214" r="4" fill="#fbf7ee"/>
<!-- Schornstein -->
<rect x="410" y="0" width="26" height="60" fill="#56647a"/>
</g>
<!-- Linde -->
<g transform="translate(1150 300)">
<rect x="40" y="150" width="26" height="130" rx="8" fill="#7a5a3a"/>
<circle cx="53" cy="110" r="96" fill="#3d9a6e"/>
<circle cx="0" cy="140" r="62" fill="#47a778"/>
<circle cx="110" cy="138" r="66" fill="#338a61"/>
<circle cx="60" cy="50" r="58" fill="#56b485"/>
</g>
<!-- kleiner Baum links -->
<g transform="translate(360 380)">
<rect x="22" y="80" width="16" height="90" rx="6" fill="#7a5a3a"/>
<circle cx="30" cy="62" r="56" fill="#47a778"/>
<circle cx="58" cy="84" r="36" fill="#338a61"/>
</g>
<!-- Hügel vorne -->
<path d="M0 560 C 260 510, 520 600, 820 570 S 1360 520, 1600 560 V700 H0 Z" fill="url(#hillFront)"/>
<!-- Weg -->
<path d="M770 700 C 790 640, 780 610, 800 580 L 830 580 C 820 620, 840 650, 880 700 Z" fill="#e9dcb8" opacity="0.9"/>
</svg>

After

Width:  |  Height:  |  Size: 2.9 KiB