import type { Metadata } from "next"; import { Hero } from "@/components/hero"; import { BeekeeperNote, CurrentHarvest, OriginStory, Philosophy, ProductSpotlight, } from "@/components/home-sections-a"; import { ProcessTimeline, RegionalSection, Sustainability, BusinessTeaser, Reviews, } from "@/components/home-sections-b"; import { NewsletterSignup } from "@/components/newsletter-signup"; import { getActiveProducts } from "@/lib/data"; import { getReviewSummariesByProductIds } from "@/lib/reviews"; import { getContentValues } from "@/lib/content"; import { getCompanyInfo } from "@/lib/company-info"; import { getLocale } from "@/i18n/locale"; export const metadata: Metadata = { alternates: { canonical: "/" } }; // Zeigt immer die aktuelle Ernte/den aktuellen Lagerbestand und entkoppelt // den Docker-Build-Schritt von einer zur Build-Zeit erreichbaren Datenbank. export const dynamic = "force-dynamic"; export default async function HomePage() { const locale = await getLocale(); const [heroContent, company] = await Promise.all([ getContentValues( ["home.hero.intro", "home.hero.footnote", "home.hero.image", "home.hero.video"], locale ), getCompanyInfo(), ]); const products = await getActiveProducts(); const honeyProducts = products.filter((p) => p.category === "HONIG"); const reviewSummaries = await getReviewSummariesByProductIds(honeyProducts.map((p) => p.id)); const spotlightProduct = products.find( (p) => p.category === "HONIG" && p.harvest && p.batch ) as (typeof products)[number] & { harvest: NonNullable<(typeof products)[number]["harvest"]>; batch: NonNullable<(typeof products)[number]["batch"]>; } | undefined; return ( <> {spotlightProduct ? : null} ); }