import { getTranslations } from "next-intl/server"; import { CampaignBanners } from "@/components/organisms/CampaignBanners"; import { SiteFooter } from "@/components/organisms/SiteFooter"; import { SiteHeader } from "@/components/organisms/SiteHeader"; import { buildHomeNavWithCourseTags } from "@/lib/course-nav"; import { getCourses } from "@/lib/data/courses"; import { listPublishedCourseTags } from "@/lib/data/taxonomy"; import { getPrograms } from "@/lib/data/programs"; import { getCampaignBanners } from "@/lib/data/site"; import { facultySiteUrl, siteShortName } from "@/lib/site-config"; // Public CMS pages must read Postgres at request time — static bake at Docker // build often has no DATABASE_URL and ships empty lists. export const dynamic = "force-dynamic"; export default async function MainLayout({ children, }: Readonly<{ children: React.ReactNode; }>) { const t = await getTranslations(); const year = new Date().getFullYear(); let courses: Awaited> = []; let programs: Awaited> = []; let banners: Awaited> = []; let navTags: Awaited> = []; try { [courses, programs, banners, navTags] = await Promise.all([ getCourses(), getPrograms(), getCampaignBanners(), listPublishedCourseTags({ navOnly: true }), ]); } catch (err) { console.error("[main/layout] CMS fetch failed:", err); } const navItems = buildHomeNavWithCourseTags(navTags); return ( <>
{children}
); }