|
|
@@ -21,7 +21,7 @@ export default function MapPicker({ onSelect, onClose }: MapPickerProps) {
|
|
|
if (!mapRef.current || mapInstanceRef.current) return
|
|
|
|
|
|
const map = L.map(mapRef.current, {
|
|
|
- zoomControl: false,
|
|
|
+ zoomControl: true,
|
|
|
attributionControl: false,
|
|
|
}).setView([lat, lng], 14)
|
|
|
|
|
|
@@ -61,16 +61,23 @@ export default function MapPicker({ onSelect, onClose }: MapPickerProps) {
|
|
|
`https://nominatim.openstreetmap.org/reverse?lat=${lat}&lon=${lng}&format=json&accept-language=ru`,
|
|
|
{ headers: { 'User-Agent': 'Photoplaces/1.0' } }
|
|
|
)
|
|
|
- const data = await res.json()
|
|
|
- onSelect(lat, lng, data.display_name || undefined)
|
|
|
+ if (res.ok) {
|
|
|
+ const data = await res.json()
|
|
|
+ if (data.display_name) {
|
|
|
+ onSelect(lat, lng, data.display_name)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
} catch {
|
|
|
- onSelect(lat, lng)
|
|
|
+ // игнорируем ошибку геокодирования
|
|
|
}
|
|
|
+ onSelect(lat, lng)
|
|
|
}
|
|
|
|
|
|
return (
|
|
|
- <div className="fixed inset-0 z-[60] flex flex-col bg-black/80 backdrop-blur-sm">
|
|
|
- <div ref={mapRef} className="flex-1" />
|
|
|
+ <div className="fixed inset-0 z-[60] flex flex-col bg-black">
|
|
|
+ <div ref={mapRef} className="min-h-0 flex-1 bg-[#1e293b]" />
|
|
|
+ <style>{'.leaflet-container { background: #1e293b !important; }'}</style>
|
|
|
<div className="flex items-center justify-between bg-[#1e293b] px-4 py-3">
|
|
|
<div className="text-sm text-white/60">
|
|
|
{lat.toFixed(6)}, {lng.toFixed(6)}
|