"use client"; import { CircleMarker, LayerGroup, Popup } from "react-leaflet"; import type { CustomPoi } from "@/types/customPoi"; // --------------------------------------------------------------------------- // Props // --------------------------------------------------------------------------- interface Props { pois: CustomPoi[]; onEdit: (poi: CustomPoi) => void; onDelete: (id: number) => void; } // --------------------------------------------------------------------------- // Color helpers // --------------------------------------------------------------------------- function markerColor(weight: number): string { if (weight > 0) return "#16a34a"; // green — positive if (weight < 0) return "#dc2626"; // red — negative return "#6b7280"; // gray — neutral } function weightLabel(weight: number): string { if (weight > 0) return `+${weight}`; return String(weight); } // --------------------------------------------------------------------------- // Component // --------------------------------------------------------------------------- export function CustomPoiLayer({ pois, onEdit, onDelete }: Props) { if (!pois.length) return null; return ( {pois.map((poi) => { const color = markerColor(poi.weight); return (
{poi.name}
{poi.category && (
{poi.category}
)}
Вес: {weightLabel(poi.weight)}
{poi.notes && (
{poi.notes}
)}
); })}
); }