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 { mapFileSlugToTranslated } from '@/lib/slugs'; import { SITE_URL } from '@/lib/schema'; import TrackedLink from '@/components/analytics/TrackedLink'; 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.has('meta.title') ? t('meta.title') : t.has('breadcrumb') ? t('breadcrumb') : 'Products'; const description = t('meta.description') || t('subtitle'); return { title, description, alternates: { canonical: `${SITE_URL}/${locale}/${await mapFileSlugToTranslated('products', locale)}`, languages: { de: `${SITE_URL}/de/${await mapFileSlugToTranslated('products', 'de')}`, en: `${SITE_URL}/en/${await mapFileSlugToTranslated('products', 'en')}`, 'x-default': `${SITE_URL}/en/${await mapFileSlugToTranslated('products', 'en')}`, }, }, openGraph: { title: `${title} | KLZ Cables`, description, url: `${SITE_URL}/${locale}/${await mapFileSlugToTranslated('products', 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 productsSlug = await mapFileSlugToTranslated('products', 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}/${productsSlug}/${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}/${productsSlug}/${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}/${productsSlug}/${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}/${productsSlug}/${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')}

); }