|
|
@@ -23,11 +23,10 @@ export default function MapPicker({ onSelect, onClose }: MapPickerProps) {
|
|
|
const map = L.map(mapRef.current, {
|
|
|
zoomControl: false,
|
|
|
attributionControl: false,
|
|
|
- }).setView([lat, lng], 14)
|
|
|
+ }).setView([lat, lng], 12)
|
|
|
|
|
|
- L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
|
|
+ L.tileLayer('https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png', {
|
|
|
maxZoom: 19,
|
|
|
- attribution: '© <a href="https://openstreetmap.org">OSM</a>',
|
|
|
}).addTo(map)
|
|
|
|
|
|
map.on('click', (e) => {
|
|
|
@@ -36,14 +35,7 @@ export default function MapPicker({ onSelect, onClose }: MapPickerProps) {
|
|
|
setLat(newLat)
|
|
|
setLng(newLng)
|
|
|
if (markerRef.current) markerRef.current.remove()
|
|
|
- markerRef.current = L.marker([newLat, newLng], {
|
|
|
- icon: L.divIcon({
|
|
|
- className: '',
|
|
|
- iconSize: [12, 12],
|
|
|
- iconAnchor: [6, 6],
|
|
|
- html: '<div style="width:12px;height:12px;background:#FF4B4B;border-radius:50%;border:2px solid white"></div>',
|
|
|
- }),
|
|
|
- }).addTo(map)
|
|
|
+ markerRef.current = L.marker([newLat, newLng]).addTo(map)
|
|
|
})
|
|
|
|
|
|
mapInstanceRef.current = map
|
|
|
@@ -58,8 +50,7 @@ export default function MapPicker({ onSelect, onClose }: MapPickerProps) {
|
|
|
setLoading(true)
|
|
|
try {
|
|
|
const res = await fetch(
|
|
|
- `https://nominatim.openstreetmap.org/reverse?lat=${lat}&lon=${lng}&format=json&accept-language=ru`,
|
|
|
- { headers: { 'User-Agent': 'Photoplaces/1.0' } }
|
|
|
+ `https://nominatim.openstreetmap.org/reverse?lat=${lat}&lon=${lng}&format=json&accept-language=ru`
|
|
|
)
|
|
|
const data = await res.json()
|
|
|
onSelect(lat, lng, data.display_name || undefined)
|