import { notFound } from 'next/navigation'; import { getPageBySlug, getAllPages, getMediaById } from '@/lib/data'; import { Metadata } from 'next'; import { SEO } from '@/components/SEO'; import { ContentRenderer } from '@/components/content/ContentRenderer'; import { Breadcrumbs } from '@/components/content/Breadcrumbs'; import { Hero } from '@/components/content/Hero'; import { ContactForm } from '@/components/ContactForm'; import { ResponsiveSection, ResponsiveWrapper } from '@/components/layout/ResponsiveWrapper'; interface PageProps { params: { locale: string; }; } export async function generateStaticParams() { const pages = await getAllPages(); // Filter for contact pages only const contactPages = pages.filter(p => p.slug === 'contact' || p.slug === 'kontakt'); return contactPages.map((page) => ({ locale: page.locale, })); } export async function generateMetadata({ params }: PageProps): Promise { const { locale } = params; const slug = locale === 'de' ? 'kontakt' : 'contact'; const page = await getPageBySlug(slug, locale); if (!page) { return { title: 'Contact Not Found', }; } return { title: page.title, description: page.excerptHtml || '', alternates: { languages: { de: '/de/kontakt', en: '/en/contact', }, }, }; } export default async function ContactPage({ params }: PageProps) { const { locale } = params; const slug = locale === 'de' ? 'kontakt' : 'contact'; const page = await getPageBySlug(slug, locale); if (!page) { notFound(); } // Get featured image if available const featuredImage = page.featuredImage ? getMediaById(page.featuredImage) : null; // Content is already processed during data export const contentToDisplay = page.contentHtml && page.contentHtml.trim() !== '' ? page.contentHtml : page.excerptHtml; // Breadcrumb items const breadcrumbItems = [ { label: locale === 'de' ? 'Kontakt' : 'Contact' } ]; return ( <> {/* Breadcrumbs */} {/* Hero Section with Featured Image */} {featuredImage && ( ]*>/g, '') : undefined} backgroundImage={featuredImage.localPath} backgroundAlt={page.title} height="md" variant="dark" overlay={true} overlayOpacity={0.5} /> )} {/* Main Content */} {!featuredImage && (

{page.title}

{page.excerptHtml && ( )}
)} {/* Content from WordPress */} {contentToDisplay && ( )} {/* Contact Form */}
); }