'use client'; import React, { useState, useRef, useCallback, useMemo } from 'react'; import { MapPin, ArrowUpRight } from 'lucide-react'; import Image from 'next/image'; import { usePathname } from 'next/navigation'; import Link from 'next/link'; import dynamic from 'next/dynamic'; import { AnimatedGlossyBorder } from '@/components/ui/AnimatedGlossyBorder'; import { Location, projectLocations } from '@/lib/map-data'; import { standorteLocations } from '@/lib/standorte-data'; import { useLocale, useTranslations } from 'next-intl'; const InteractiveMapPins = dynamic(() => import('./InteractiveMapPins'), { ssr: false, }); interface Stat { value: string; suffix?: string; label: string; href?: string; } interface InteractiveGermanyMapProps { badge?: string; title?: React.ReactNode; description?: string; stats?: Stat[]; locations?: Location[]; isHero?: boolean; hideStandorte?: boolean; } export function InteractiveGermanyMap({ badge, title, description, stats, locations = projectLocations, isHero = false, hideStandorte = false }: InteractiveGermanyMapProps) { const [activeLocation, setActiveLocation] = useState(null); const hoverTimeoutRef = useRef(null); const handleMouseEnter = useCallback((loc: Location) => { if (hoverTimeoutRef.current) { clearTimeout(hoverTimeoutRef.current); hoverTimeoutRef.current = null; } setActiveLocation(loc); }, []); const handleMouseLeave = useCallback(() => { const timeout = setTimeout(() => { setActiveLocation(null); }, 200); hoverTimeoutRef.current = timeout; }, []); const pathname = usePathname(); const locale = useLocale(); const t = useTranslations('InteractiveGermanyMap'); const tStandard = useTranslations('StandardPage'); const finalStats = stats || [ { value: '100', suffix: '%', label: locale === 'en' ? 'Nationwide Reach' : 'Überregionale Reichweite' }, { value: '3', suffix: '', label: locale === 'en' ? 'Operational Locations' : 'Operative Standorte', href: `/${locale}/standorte` }, ]; const finalBadge = badge || tStandard('badge'); const finalTitle = title || (locale === 'en' ? <>Nationwide
in operation for you. : <>Deutschlandweit
für Sie im Einsatz.); const finalDescription = description || (locale === 'en' ? 'From our strategic locations in Guben, Kirchheilingen and Bülstedt, we control and implement complex infrastructure projects nationwide.' : 'Von unseren strategischen Standorten in Guben, Kirchheilingen und Bülstedt steuern und realisieren wir komplexe Infrastrukturprojekte im gesamten Bundesgebiet.'); const finalLocations = useMemo(() => { if (hideStandorte) return locations; const base = [...locations]; standorteLocations.forEach(sl => { if (!base.some(l => l.id === sl.id)) { base.push(sl as Location); } }); return base; }, [locations, hideStandorte]); const mapBackground = useMemo(() => (
{locale
), [locale]); return (
{!isHero && }
{finalBadge}
{isHero ? (

{finalTitle}

) : (

{finalTitle}

)}

{finalDescription}

{finalStats.map((stat, i) => { const StatCard = () => (
{stat.value}{stat.suffix}
{stat.label} {stat.href && }
); return stat.href ? ( ) : (
); })}
{mapBackground}
); }