Deploy edu.mstaut.ir / deploy (push) Has been cancelled
Production already has migrations through 008; 009 only updates four seed labels by id. Faculty sync remains upsert-by-email/name and does not wipe curated data. Co-authored-by: Cursor <cursoragent@cursor.com>
66 lines
2.3 KiB
TypeScript
66 lines
2.3 KiB
TypeScript
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<ReturnType<typeof getCourses>> = [];
|
|
let programs: Awaited<ReturnType<typeof getPrograms>> = [];
|
|
let banners: Awaited<ReturnType<typeof getCampaignBanners>> = [];
|
|
let navTags: Awaited<ReturnType<typeof listPublishedCourseTags>> = [];
|
|
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 (
|
|
<>
|
|
<SiteHeader
|
|
items={navItems}
|
|
searchLabel={t("nav.search")}
|
|
contactLabel={t("nav.contact")}
|
|
brandTitle={siteShortName}
|
|
brandSubtitle={t("nav.brandSubtitle")}
|
|
variant="home"
|
|
courses={courses}
|
|
programs={programs}
|
|
/>
|
|
<CampaignBanners banners={banners} />
|
|
<div className="min-w-0 flex-1 overflow-x-clip">{children}</div>
|
|
<SiteFooter
|
|
copyright={t("footer.copyright", { year })}
|
|
linksTitle={t("footer.links")}
|
|
links={[
|
|
{ label: t("footer.facultySite"), href: facultySiteUrl },
|
|
{ label: t("footer.press"), href: "/press" },
|
|
{ label: t("footer.careers"), href: "/careers" },
|
|
]}
|
|
/>
|
|
</>
|
|
);
|
|
}
|