"use client"; import { useState } from "react"; import type { CustomPoi, CustomPoiUpdate } from "@/types/customPoi"; interface Props { poi: CustomPoi; onSubmit: (data: CustomPoiUpdate) => void; onCancel: () => void; isLoading?: boolean; } const CATEGORY_OPTIONS = [ "school", "kindergarten", "pharmacy", "hospital", "clinic", "shop_mall", "shop_supermarket", "shop_small", "park", "tram_stop", "bus_stop", "metro_stop", "cafe", "restaurant", "bank", "atm", "post_office", "library", "sports_centre", "gym", "cinema", "theatre", "hotel", "fuel", "parking", "Другое", ] as const; export function CustomPoiEditModal({ poi, onSubmit, onCancel, isLoading = false, }: Props) { const [name, setName] = useState(poi.name); const [category, setCategory] = useState(poi.category ?? "Другое"); const [weight, setWeight] = useState(poi.weight); const [notes, setNotes] = useState(poi.notes ?? ""); function handleSubmit(e: React.FormEvent) { e.preventDefault(); onSubmit({ name: name.trim() || poi.name, category: category === "Другое" ? null : category, weight, notes: notes.trim() || null, }); } const weightColor = weight > 0 ? "#16a34a" : weight < 0 ? "#dc2626" : "#6b7280"; return (
{ if (e.target === e.currentTarget) onCancel(); }} >
e.stopPropagation()} >

Изменить точку

setName(e.target.value)} style={{ width: "100%", padding: "8px 10px", fontSize: 13, border: "1px solid #d1d5db", borderRadius: 7, boxSizing: "border-box", }} autoFocus />
setWeight(Number(e.target.value))} style={{ width: "100%" }} />