refactor(post-events): read event data from resolved calendarItem
Deploy / verify (push) Successful in 47s
Deploy / deploy (push) Successful in 53s

Replace direct post.isEvent/eventDate/eventLocation reads with
getPostEventInfo() helper that derives info from the resolved
calendarItem reference. Loaders now resolve "calendarItem" and request
that field instead of legacy flat properties.

Also regenerate iconify mdi subset (map-marker-outline, download,
google, calendar-search, refresh).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Peter Meier
2026-05-07 16:08:16 +02:00
parent fc6c59bc10
commit 892afc2d9f
6 changed files with 112 additions and 61 deletions
+5 -5
View File
@@ -12,6 +12,7 @@ import {
resolveDeadlineBannerBlocks,
getPostImageField,
formatPostDate,
getPostEventInfo,
} from '$lib/blog-utils';
import { POST_RESOLVE, POST_SOCIAL_IMAGE_TRANSFORM, SITE_NAME } from '$lib/constants';
import { env } from '$env/dynamic/public';
@@ -110,8 +111,9 @@ export const load: PageServerLoad = async ({ params, locals, url, setHeaders })
const postHeadline = post.headline ?? post.linkName ?? slug;
const postDescription = post.seoDescription ?? post.subheadline ?? post.excerpt ?? '';
const isEvent = !!(post as { isEvent?: boolean }).isEvent;
const eventDateRaw = (post as { eventDate?: string }).eventDate ?? null;
const eventInfo = getPostEventInfo(post);
const isEvent = eventInfo.isEvent;
const eventDateRaw = eventInfo.eventDate;
const eventDateLabel =
isEvent && eventDateRaw
? new Date(eventDateRaw).toLocaleDateString('de-DE', {
@@ -123,9 +125,7 @@ export const load: PageServerLoad = async ({ params, locals, url, setHeaders })
minute: '2-digit',
})
: null;
const eventLocation = isEvent
? ((post as { eventLocation?: { text?: string; lat?: number; lng?: number } }).eventLocation ?? null)
: null;
const eventLocation = eventInfo.eventLocation;
const hasCoords = !!(eventLocation?.lat && eventLocation?.lng);
const _lat = eventLocation?.lat ?? 0;