import type { Metadata } from "next"; import { notFound } from "next/navigation"; import { Container } from "@/components/ui"; import { ContentImage } from "@/components/content-image"; import { ScrollReveal } from "@/components/scroll-reveal"; import { TrustBadges } from "@/components/trust-badges"; import { ShieldIcon } from "@/components/account-ui"; import { ProductTeaserLink } from "@/components/product-card"; import { getBatchByCode } from "@/lib/data"; import { formatDate } from "@/lib/format"; import { getLocale } from "@/i18n/locale"; import { getDictionary } from "@/i18n/get-dictionary"; // Siehe Begruendung in app/honig/[slug]/page.tsx. export const dynamic = "force-dynamic"; export async function generateMetadata( props: PageProps<"/charge/[code]"> ): Promise { const { code } = await props.params; return { title: `Charge ${code}`, alternates: { canonical: `/charge/${code}` } }; } /** * Chargen-Seite, die ueber den QR-Code auf jedem Wabenhain-Glas erreichbar * ist (wabenhain.com/charge/{code}). Zeigt Herkunft, Erntezeitraum und * Abfuelldatum der konkreten Charge, aus der das Glas stammt — der Moment, * in dem jemand mit dem Glas in der Hand die Herkunftsangaben nachprueft. */ export default async function BatchPage(props: PageProps<"/charge/[code]">) { const locale = await getLocale(); const t = getDictionary(locale); const { code } = await props.params; const batch = await getBatchByCode(code); if (!batch) notFound(); const steps = [ { label: t.chargePage.stepHarvest, value: formatDate(batch.harvest.harvestDate, locale) }, { label: t.chargePage.stepFilling, value: formatDate(batch.fillDate, locale) }, { label: t.chargePage.stepBestBefore, value: formatDate(batch.bestBeforeDate, locale) }, ]; // Eigene Chargenfotos (z.B. Etikett/Abfuellung dieser konkreten Charge) // gehen PRO Slot vor, falls gepflegt — sonst faellt genau dieser Slot auf // das entsprechende Erntebild zurueck. Bewusst NICHT alles-oder-nichts: // wer nur ein Chargenfoto pflegt, soll nicht das zweite (Standort-)Bild // verlieren, nur weil die Charge kein zweites eigenes Foto hat. // "||" statt "??": ein im Admin geleerter Slot kommt als leerer String // an, nicht als undefined (siehe imageSlots() in // admin/actions/harvests-batches.ts). Mit "??" wuerde dieser leere String // als gueltiger Wert durchgehen und das Erntebild darunter verdecken. const displayImages = [ batch.images[0] || batch.harvest.images[0] || null, batch.images[1] || batch.harvest.images[1] || null, ]; return (
{/* Echtheitssiegel: wer den QR-Code vom Glas scannt, landet hier — das Siegel stempelt sich ein, bevor die Details folgen. */}
{t.chargePage.verifiedBatch}

{batch.harvest.type} {batch.harvest.year}

{t.chargePage.provenanceNote(batch.code)}

    {steps.map((step, i) => (
  1. {i < steps.length - 1 ? (

    {step.label}

    {step.value}

  2. ))}

{t.chargePage.regionLabel}

{batch.harvest.location}

{batch.harvest.description}

{batch.products.length > 0 ? (

{t.chargePage.fromThisBatch}

{batch.products.map((product) => ( ))}
) : null}
); }