refactor(post-events): read event data from resolved calendarItem
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user