"use client"; import { X, ExternalLink, Clock, Zap, MapPin, Building2, Truck } from "lucide-react"; import type { ChargeFeature, EnrichedLocation } from "@/types/charging"; import { formatConnectorStandard, formatPowerType, statusColorClass, statusLabel } from "@/lib/connectorLabels"; import UsageChart from "@/components/UsageChart"; interface Props { selected: ChargeFeature | null; detail: EnrichedLocation | null; loading: boolean; slug?: string; // gemeente slug for usage history (undefined / 'nederland' = no chart) onClose: () => void; onJumpToGemeente?: () => void; } export default function LocationDetailPanel({ selected, detail, loading, slug, onClose, onJumpToGemeente }: Props) { if (!selected) return null; const p = selected.properties; const isFreight = p.layer === "freight"; return (
{isFreight ? : } {isFreight ? "Vracht" : "Personenauto"} {p.isMegawatt && ( Megawatt )}

{p.name}

{p.address && (
{p.address} {p.city ? `, ${p.city}` : ""}
)}
{/* Operator */}

Exploitant

{p.operatorName || "Onbekend"}
{detail?.operatorWebsite && ( {detail.operatorWebsite} )}
Bron: {p.source.toUpperCase()}
{/* Usage over time (gemeente view only; per-gemeente snapshot history) */} {slug && slug !== "nederland" && } {loading && (
Details laden…
)} {!loading && detail && ( <> {/* General */}

Gegevens

{detail.twentyFourSeven ? "Ja" : "Nee"} {detail.maxPowerKw > 0 && {detail.maxPowerKw} kW} {detail.parkingType && ( {detail.parkingType.replace(/_/g, " ")} )} {detail.ocpiId} {new Date(detail.lastUpdated).toLocaleString("nl-NL")}
{/* EVSEs */} {detail.evses.length > 0 && (

Laadpunten ({detail.evses.length})

{detail.evses.map((evse) => (
{evse.evse_id} {statusLabel(evse.status)}
{evse.connectors.length > 0 && (
{evse.connectors.map((c) => (
{formatConnectorStandard(c.standard)} {c.format}
{formatPowerType(c.power_type)} {c.max_electric_power ? ( {(c.max_electric_power / 1000).toFixed(1)} kW ) : null}
{c.tariffs.length > 0 && c.tariffs[0].elements?.[0]?.price_components?.[0] && (
Tarief: {c.tariffs[0].elements[0].price_components[0].price}{" "} {c.tariffs[0].currency} / {c.tariffs[0].elements[0].price_components[0].type.toLowerCase()}
)}
))}
)}
))}
)} )} {!loading && !detail && (

Geen gedetailleerde informatie geladen voor deze locatie {p.maxPowerKw > 0 ? ` (max. ${p.maxPowerKw} kW).` : "."}

{onJumpToGemeente && ( )}
)}
); } function Row({ label, children }: { label: string; children: React.ReactNode }) { return (
{label}: {children}
); }