feat(deadline-banner): auto mode pulls all calendar_items globally
Deploy / verify (push) Successful in 40s
Deploy / deploy (push) Successful in 59s

Auto-mode deadline_banner now resolves to the next future event across
all calendar_items in the CMS instead of requiring a manually-curated
items[] pool. Server load hooks (+page.server.ts for /, /[...slug],
/post/[slug]) call resolveDeadlineBannerBlocks which fetches the
global calendar_item list once and attaches it as items[] when mode
is "auto" and items[] is not already resolved. Component logic
unchanged — it still picks the soonest future entry.

Also:
- cms.ts: getCalendarItems() bulk list fetcher
- PostOverviewBlock.svelte: design defaults to "cards" when value is
  empty string (not just null/undefined) so existing entries with
  design: "" render

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Peter Meier
2026-04-19 11:02:50 +02:00
parent ffd4f599cd
commit 62d25202a6
9 changed files with 242 additions and 1 deletions
+17
View File
@@ -666,3 +666,20 @@ export async function getCalendarItemBySlug(
return (await res.json()) as CalendarItemEntry;
});
}
/** Alle calendar_item-Einträge (GET /api/content/calendar_item). */
export async function getCalendarItems(
options?: { locale?: string },
): Promise<CalendarItemEntry[]> {
const key = `calendar_item:list:${options?.locale ?? ""}`;
return cached("calendar_item", key, async () => {
const base = getBaseUrl();
const url = new URL(`${base}/api/content/calendar_item`);
url.searchParams.set("_per_page", "1000");
if (options?.locale) url.searchParams.set("_locale", options.locale);
const res = await fetch(url.toString());
if (!res.ok) return [];
const data = (await res.json()) as { items?: CalendarItemEntry[] };
return data.items ?? [];
});
}