'use client'; import React, { useState } from 'react'; import { motion, AnimatePresence } from 'framer-motion'; import { MapPin, Factory, Zap, CheckCircle2, ArrowUpRight } from 'lucide-react'; import Image from 'next/image'; import { useRouter } from 'next/navigation'; import { AnimatedGlossyBorder } from '@/components/ui/AnimatedGlossyBorder'; import { Location, defaultLocations } from '@/lib/map-data'; interface Stat { value: string; suffix?: string; label: string; } interface InteractiveGermanyMapProps { badge?: string; title?: React.ReactNode; description?: string; stats?: Stat[]; locations?: Location[]; isHero?: boolean; } export function InteractiveGermanyMap({ badge = 'Einsatzgebiete', title = <>Deutschlandweit
für Sie im Einsatz., description = 'Von unseren strategischen Standorten in Guben und Bülstedt steuern und realisieren wir komplexe Infrastrukturprojekte im gesamten Bundesgebiet.', stats = [ { value: '100', suffix: '%', label: 'Überregionale Reichweite' }, { value: '2', suffix: '+', label: 'Operative Standorte' }, ], locations = defaultLocations, isHero = false }: InteractiveGermanyMapProps) { const [activeLocation, setActiveLocation] = useState(null); const router = useRouter(); const hq = locations.find((l) => l.type === 'hq'); const branch = locations.find((l) => l.type === 'branch'); const projects = locations.filter((l) => l.type === 'project'); return (
{/* Animated Border Glow */} {/* Background Effects */}
{/* Content Left */}
{badge}
{isHero ? (

{title}

) : (

{title}

)}

{description}

{/* Industrial Stats Grid */}
{stats.map((stat, i) => (
{stat.value}{stat.suffix}
{stat.label}
))}
{/* Map Right */}
{/* Map Container - Enforce strict aspect ratio matching the SVG (1024x1024) */}
{/* Map SVG */}
Deutschlandkarte
{/* Connections (Lines) */} {hq && branch && ( )} {hq && projects.map((proj, idx) => ( ))} {/* Location Pins */} {locations.map((loc, idx) => { const isHQ = loc.type === 'hq'; const isBranch = loc.type === 'branch'; const isActive = activeLocation?.id === loc.id; const isNearLeft = loc.x < 50; const isNearRight = loc.x >= 50; const isNearTop = loc.y < 55; // 55% threshold to strongly avoid the top header const tooltipClasses = [ 'absolute w-[280px] sm:w-64 bg-white text-neutral-dark p-5 rounded-2xl shadow-2xl z-[9999] border border-neutral-100', isNearLeft ? 'left-1/2 sm:left-0 -translate-x-1/2 sm:translate-x-0' : 'left-1/2 sm:left-auto sm:right-0 -translate-x-1/2 sm:translate-x-0', isNearTop ? 'top-full mt-4 before:absolute before:-top-6 before:left-0 before:w-full before:h-6' : 'bottom-full mb-4 before:absolute before:-bottom-6 before:left-0 before:w-full before:h-6' ].join(' '); const arrowClasses = [ 'absolute border-8 border-transparent drop-shadow-sm hidden sm:block', isNearLeft ? 'left-6' : 'right-6', isNearTop ? '-top-4 border-b-white border-t-0' : '-bottom-4 border-t-white border-b-0' ].join(' '); return (
setActiveLocation(loc)} onMouseLeave={() => setActiveLocation(null)} onClick={() => { if (loc.href) router.push(loc.href); }} > {/* Ping Animation for HQ / Branch */} {(isHQ || isBranch) && (
)} {/* Marker Dot */} {(isHQ || isBranch) && } {/* Tooltip */} {isActive && ( {loc.featuredImage && ( {loc.name}
{isHQ ? : } {loc.name}
)}
{!loc.featuredImage && ( {isHQ ? : } {loc.name} )} {loc.description} {loc.details && (
    {loc.details.map((detail, i) => (
    {detail}
    ))}
)} {loc.href && ( Zum Projekt )}
{/* Arrow Down/Up */}
)}
); })}
); }