import Reveal from '@/components/Reveal'; import Scribble from '@/components/Scribble'; import { Badge, Button, Card, Container, Heading, Section } from '@/components/ui'; import { getTranslations, setRequestLocale } from 'next-intl/server'; import { Metadata } from 'next'; import Image from 'next/image'; import Link from 'next/link'; import { mapFileSlugToTranslated } from '@/lib/slugs'; import { getOGImageMetadata } from '@/lib/metadata'; import { SITE_URL } from '@/lib/schema'; interface ProductsPageProps { params: Promise<{ locale: string; }>; } export async function generateMetadata({ params }: ProductsPageProps): Promise { const { locale } = await params; const t = await getTranslations({ locale, namespace: 'Products' }); const title = t('meta.title') || t('title'); const description = t('meta.description') || t('subtitle'); return { title, description, alternates: { canonical: `/${locale}/products`, languages: { de: '/de/products', en: '/en/products', 'x-default': '/en/products', }, }, openGraph: { title: `${title} | KLZ Cables`, description, url: `${SITE_URL}/${locale}/products`, images: getOGImageMetadata('products', title, locale), }, twitter: { card: 'summary_large_image', title: `${title} | KLZ Cables`, description, }, }; } export default async function ProductsPage({ params }: ProductsPageProps) { const { locale } = await params; setRequestLocale(locale); const t = await getTranslations('Products'); // Get translated category slugs const lowVoltageSlug = await mapFileSlugToTranslated('low-voltage-cables', locale); const mediumVoltageSlug = await mapFileSlugToTranslated('medium-voltage-cables', locale); const highVoltageSlug = await mapFileSlugToTranslated('high-voltage-cables', locale); const solarSlug = await mapFileSlugToTranslated('solar-cables', locale); const categories = [ { title: t('categories.lowVoltage.title'), desc: t('categories.lowVoltage.description'), img: '/uploads/2024/11/low-voltage-category.webp', icon: '/uploads/2024/11/Low-Voltage.svg', href: `/${locale}/products/${lowVoltageSlug}`, }, { title: t('categories.mediumVoltage.title'), desc: t('categories.mediumVoltage.description'), img: '/uploads/2024/11/medium-voltage-category.webp', icon: '/uploads/2024/11/Medium-Voltage.svg', href: `/${locale}/products/${mediumVoltageSlug}`, }, { title: t('categories.highVoltage.title'), desc: t('categories.highVoltage.description'), img: '/uploads/2024/11/high-voltage-category.webp', icon: '/uploads/2024/11/High-Voltage.svg', href: `/${locale}/products/${highVoltageSlug}`, }, { title: t('categories.solar.title'), desc: t('categories.solar.description'), img: '/uploads/2024/11/solar-category.webp', icon: '/uploads/2024/11/Solar.svg', href: `/${locale}/products/${solarSlug}`, }, ]; return (
{/* Hero Section */}
{t('heroSubtitle')} {t.rich('title', { green: (chunks) => ( {chunks} ), })}

{t('subtitle')}

{categories.map((category, idx) => (
{category.title}
{t('categoryLabel')}

{category.title}

{category.desc}

{t('viewProducts')}
))}
{/* Technical Support CTA */}

{t('cta.title')}

{t('cta.description')}

); }