From 0b3ddd86e3e9aaac8c633a12e95598995990e353 Mon Sep 17 00:00:00 2001 From: Peter Meier Date: Sun, 21 Jun 2026 13:17:27 +0200 Subject: [PATCH] feat(termin): Detailseite-Redesign + gedeckeltes Bild - 2-Spalten-Layout (Inhalt auf Lesebreite, sticky Aktions-Card rechts) - Bild gedeckelt (max-h-440, contained, Hover-Zoom) statt full-width - Countdown-Badge (Heute/Morgen/in X Tagen/vergangen) - Aktionen gruppiert: "Zum Kalender" (ICS/Google) + "Teilen" (Link/QR/Bild) Co-Authored-By: Claude Opus 4.8 (1M context) --- src/lib/iconify-mdi-subset.generated.json | 7 +- src/routes/termin/[slug]/+page.svelte | 294 +++++++++++++--------- 2 files changed, 184 insertions(+), 117 deletions(-) diff --git a/src/lib/iconify-mdi-subset.generated.json b/src/lib/iconify-mdi-subset.generated.json index 1d18677..4e63da7 100644 --- a/src/lib/iconify-mdi-subset.generated.json +++ b/src/lib/iconify-mdi-subset.generated.json @@ -228,8 +228,11 @@ "home-outline": { "body": "" }, - "calendar-month": { - "body": "" + "calendar-blank": { + "body": "" + }, + "calendar-export": { + "body": "" }, "share-variant-outline": { "body": "" diff --git a/src/routes/termin/[slug]/+page.svelte b/src/routes/termin/[slug]/+page.svelte index 613a11f..c9963a9 100644 --- a/src/routes/termin/[slug]/+page.svelte +++ b/src/routes/termin/[slug]/+page.svelte @@ -18,10 +18,29 @@ const t = useTranslate(); const item = $derived(data.item); - // Kanonische URL dieser Seite (für ICS-Link, Teilen, QR). + // Kanonische URL dieser Seite (für ICS-Link, Teilen, QR) + relativer + // Countdown. Client-only (kein SSR), sonst Hydration-Mismatch (Server-Zeit). let pageUrl = $state(""); + let relLabel = $state(""); + let isPast = $state(false); $effect(() => { - pageUrl = typeof window !== "undefined" ? window.location.href : ""; + pageUrl = window.location.href; + if (item.terminZeit) { + const startDay = new Date(item.terminZeit).setHours(0, 0, 0, 0); + const today = new Date().setHours(0, 0, 0, 0); + const days = Math.round((startDay - today) / 86_400_000); + isPast = days < 0; + relLabel = + days === 0 + ? "Heute" + : days === 1 + ? "Morgen" + : days > 1 + ? `in ${days} Tagen` + : days === -1 + ? "Gestern" + : `vor ${-days} Tagen`; + } }); function toICS(): CalendarItemICS { @@ -98,126 +117,171 @@ -
-

Termin

-

{item.title}

+
+ + - -
- {#if item.dateLabel} -

-

- {/if} - {#if item.timeLabel} -

-

- {/if} - {#if item.locationText} -

-

+
+ Termin + {#if relLabel} + + {relLabel} + + {/if} +
+ +

{item.title}

+ +
+ + {#if item.tags.length > 0} +
+ {#each item.tags as tg} + {tg} + {/each} +
+ {/if} + + {#if thumbSrc && fullSrc} +
+ {imageAlt} + + + + {/if} - {#if item.tags.length > 0} -
- {#each item.tags as tg} - {tg} - {/each} + {#if descHtml} +
+ {@html descHtml} +
+ {/if} + +
+ {#if item.attachment} + + + {/if} + {#if item.externalLink} + + {t(T.calendar_more_info)} + + {/if} +
- {/if} - {#if thumbSrc && fullSrc} - - {/if} + +