import type { Metadata } from "next"; import Link from "next/link"; import { Container, SectionHeading } from "@/components/ui"; import { ContentImage } from "@/components/content-image"; import { getHarvests } from "@/lib/data"; import { formatMonthYear } from "@/lib/format"; import { getLocale } from "@/i18n/locale"; import { getDictionary } from "@/i18n/get-dictionary"; export const metadata: Metadata = { title: "Unsere Ernten", description: "Alle bisherigen Wabenhain-Ernten im Überblick — jede mit eigenem Charakter.", alternates: { canonical: "/ernten" }, }; // Siehe Begruendung in app/page.tsx. export const dynamic = "force-dynamic"; export default async function ErntenPage() { const t = getDictionary(await getLocale()); const harvests = await getHarvests(); const byYear = harvests.reduce>((acc, h) => { acc[h.year] = [...(acc[h.year] ?? []), h]; return acc; }, {}); const years = Object.keys(byYear).map(Number).sort((a, b) => b - a); return (
{years.map((year) => (

{year}

{byYear[year].map((harvest) => (

{harvest.type}

{t.erntenPage.batchCount(harvest.batches.length)}

))}
))} {years.length === 0 ? (

{t.erntenPage.emptyText}

) : null}
); }