import { Container, Heading, Badge } from '@/components/ui';
import { getTranslations, setRequestLocale } from 'next-intl/server';
import { Metadata } from 'next';
import { getAllReferences } from '@/lib/references';
import TrackedLink from '@/components/analytics/TrackedLink';
import { MapPin, Calendar, Briefcase } from 'lucide-react';
import { getButtonClasses, ButtonOverlay } from '@/components/ui/Button';
import { SITE_URL } from '@/lib/schema';
import Image from 'next/image';
import { InteractiveGermanyMap } from '@/components/blocks/InteractiveGermanyMap';
import { HeroSection } from '@/components/blocks/HeroSection';
import { defaultLocations, minorLocations } from '@/lib/map-data';
import { MDXRemote } from 'next-mdx-remote/rsc';
const mdxComponents = {
ul: (props: any) =>
,
li: (props: any) => ,
p: (props: any) => ,
};
interface PageProps {
params: Promise<{
locale: string;
}>;
}
export async function generateMetadata({ params }: PageProps): Promise {
const { locale } = await params;
if (locale !== 'de' && locale !== 'en') return {};
return {
title: 'Referenzen | E-TIB Gruppe',
description: 'Erfolgreich abgeschlossene Projekte der E-TIB Gruppe im Bereich Kabelnetzbau, Spülbohrtechnik und Netzinfrastruktur.',
alternates: {
canonical: `${SITE_URL}/${locale}/referenzen`,
languages: {
de: `${SITE_URL}/de/referenzen`,
en: `${SITE_URL}/en/referenzen`,
'x-default': `${SITE_URL}/en/referenzen`,
},
},
};
}
function cleanLocation(location?: string): string {
if (!location) return '';
// Remove 5 digit postal codes
let cleaned = location.replace(/\b\d{5}\b/g, '');
// Clean up multiple spaces, slashes and commas
cleaned = cleaned.replace(/\s*,\s*/g, ', ').replace(/\s*\/\s*/g, ' / ').trim();
// Remove leading/trailing slash/comma residues
cleaned = cleaned.replace(/^[,/\s]+|[,/\s]+$/g, '').trim();
return cleaned || location;
}
export default async function ReferenzenOverview(props: { params: Promise<{ locale: string }> }) {
const { locale } = await props.params;
setRequestLocale(locale);
const t = await getTranslations('StandardPage');
const references = await getAllReferences(locale);
const allLocations = [...defaultLocations, ...minorLocations];
const enrichedLocations = allLocations.map(loc => {
if (loc.type === 'project') {
const ref = references.find(r => r.slug === loc.id);
if (ref) {
return {
...loc,
featuredImage: ref.frontmatter.featuredImage,
details: [
ref.frontmatter.client || 'Kunde',
ref.frontmatter.dateString || new Date(ref.frontmatter.date).getFullYear().toString(),
],
};
}
}
return loc;
});
return (
{/* Map Section */}
{/* Main Content Area */}
{references.map((ref) => (
{/* Image Section */}
{ref.frontmatter.featuredImage ? (
) : (
)}
{/* Location Badge */}
{cleanLocation(ref.frontmatter.location)}
{/* Content Section */}
{ref.frontmatter.title}
{/* Project Details / Content */}
{ref.content && (
)}
{/* Technical Meta Data */}
{t('client')}
{ref.frontmatter.client || t('client')}
{t('period')}
{ref.frontmatter.dateString || new Date(ref.frontmatter.date).getFullYear()}
))}
{/* Support Section */}
{t('nextProjectTitle')}
{t('nextProjectDesc')}
{t('contactUs')}
→
);
}