import { notFound } from "next/navigation"; import { getTranslations } from "next-intl/server"; import { Link } from "@/i18n/navigation"; import { ProductAddToCart } from "@/components/ProductAddToCart"; import { ProductGallery } from "@/components/ProductGallery"; import { formatThicknessMm } from "@/lib/format-thickness"; import { getProductBySlug, products } from "@/lib/products"; type Props = { params: Promise<{ slug: string }> }; export function generateStaticParams() { return products.map((p) => ({ slug: p.slug })); } export async function generateMetadata({ params }: Props) { const { slug } = await params; const p = getProductBySlug(slug); if (!p) return { title: "TrustWin" }; const t = await getTranslations("products"); return { title: `${t(`${slug}.name`)} — TrustWin`, description: t(`${slug}.short`), }; } export default async function ProductPage({ params }: Props) { const { slug } = await params; const product = getProductBySlug(slug); if (!product) notFound(); const t = await getTranslations("product"); const tc = await getTranslations("catalog"); const tp = await getTranslations("products"); const tu = await getTranslations("units"); const tcl = await getTranslations("catalogLine"); const tn = await getTranslations("nav"); return (
← {t("back")}

{t("thicknessLabel")}

{product.thicknessesMm.map((mm) => ( {t("thicknessValue", { value: formatThicknessMm(mm), })} ))}

{tcl(product.catalogLineKey)}

{tn("supplier")}

{tp(`${slug}.name`)}

{tp(`${slug}.short`)}

{product.pricePerUnit.toFixed(2)}{" "} {tu(product.unitKey)}

{t("details")}

{tp(`${slug}.short`)}

); }