'use client'; import React from 'react'; import { m, AnimatePresence } from 'framer-motion'; import { MapPin, CheckCircle2, ArrowUpRight } from 'lucide-react'; import Image from 'next/image'; import Link from 'next/link'; import { Location } from '@/lib/map-data'; const MinorNode = React.memo(({ loc, isActive, onEnter, onLeave }: { loc: Location, isActive: boolean, onEnter: (loc: Location) => void, onLeave: () => void }) => (
onEnter(loc)} onMouseLeave={onLeave} onTouchStart={() => onEnter(loc)} onClick={() => onEnter(loc)} >
)); MinorNode.displayName = 'MinorNode'; const MajorNode = React.memo(({ loc, isActive, idx, onEnter, onLeave }: { loc: Location, isActive: boolean, idx: number, onEnter: (loc: Location) => void, onLeave: () => void }) => { const isHQ = loc.type === 'hq'; const isBranch = loc.type === 'branch'; return (
onEnter(loc)} onMouseLeave={onLeave} onTouchStart={() => onEnter(loc)} onClick={() => onEnter(loc)} > {(isHQ || isBranch) && (
)} {(isHQ || isBranch) && }
); }); MajorNode.displayName = 'MajorNode'; export default function InteractiveMapPins({ locations, locale, t, activeLocation, handleMouseEnter, handleMouseLeave }: { locations: Location[], locale: string, t: any, activeLocation: Location | null, handleMouseEnter: (loc: Location) => void, handleMouseLeave: () => void }) { return ( <> {locations.filter(l => l.type === 'minor_node').map((loc, idx) => ( ))} {locations.filter(l => l.type !== 'minor_node').map((loc, idx) => ( ))} {activeLocation && ( handleMouseEnter(activeLocation)} onMouseLeave={handleMouseLeave} >
{activeLocation.featuredImage && (
{activeLocation.name}
)}
{t(`types.${activeLocation.type === 'minor_node' ? 'project' : activeLocation.type}`)}
{activeLocation.name}
{activeLocation.type !== 'minor_node' ? (
{activeLocation.description}
) : (
{t(`descriptions.${['wind','pv','fiber','power','battery'].includes(activeLocation.description || '') ? activeLocation.description : 'default'}`)}
)} {(activeLocation.details || activeLocation.type === 'minor_node') && (
    {activeLocation.type === 'minor_node' ? ( <>
  • {t(`features.${['wind','pv','fiber','power','battery'].includes(activeLocation.description || '') ? activeLocation.description : 'default'}`)}
  • {t('features.method')}
  • ) : ( activeLocation.details?.map((detail, i) => (
  • {detail}
  • )) )}
)} {activeLocation.href && (activeLocation.type === 'hq' || activeLocation.type === 'branch') && ( e.stopPropagation()} > {t('learnMore')} )}
)} ); }