diff --git a/src/lib/components/blocks/CalendarBlock.svelte b/src/lib/components/blocks/CalendarBlock.svelte index a04d8c6..b5f5962 100644 --- a/src/lib/components/blocks/CalendarBlock.svelte +++ b/src/lib/components/blocks/CalendarBlock.svelte @@ -17,6 +17,7 @@ import Icon from "@iconify/svelte"; import ImageModal from "$lib/components/ImageModal.svelte"; import SocialImageModal from "$lib/components/SocialImageModal.svelte"; + import QrModal from "$lib/components/QrModal.svelte"; type EventCardItem = CalendarItemData & { start: Date; @@ -458,6 +459,18 @@ socialModal = null; } + // QR-Code zum direkten Ausgeben/Scannen (Aushang, Infostand). Nutzt die + // canonical /termin/-URL (hat OG-Tags + Redirect), Fallback = Hash- + // Anchor im Kalender wenn kein Slug. + let qrModal = $state<{ value: string; label: string } | null>(null); + + function openQr(item: EventCardItem) { + const url = item._slug + ? `${window.location.origin}/termin/${encodeURIComponent(item._slug)}/` + : `${window.location.origin}${window.location.pathname}#${eventId(item)}`; + qrModal = { value: url, label: item.title || "Termin" }; + } + function eventId(item: EventCardItem): string { if (item._slug) return `event-${item._slug}`; const titlePart = (item.title || "event") @@ -781,8 +794,21 @@
- {#if eventHref || locText || item.attachment?.src} + {#if item._slug || eventHref || locText || item.attachment?.src} {/if} @@ -1325,6 +1361,15 @@ /> {/if} +{#if qrModal} + (qrModal = null)} + /> +{/if} +