Jelajahi Sumber

Revert "fix: OSM тайлы с домами, divIcon маркер, кнопка справа от полей"

This reverts commit 26fc07019ebdc56c185cb4d8adbc31b176eaaf84.
neyrogovnarik 1 bulan lalu
induk
melakukan
00083f2e58
2 mengubah file dengan 16 tambahan dan 27 penghapusan
  1. 4 13
      frontend/src/components/MapPicker.tsx
  2. 12 14
      frontend/src/components/PlaceForm.tsx

+ 4 - 13
frontend/src/components/MapPicker.tsx

@@ -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: '&copy; <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)

+ 12 - 14
frontend/src/components/PlaceForm.tsx

@@ -164,8 +164,17 @@ export default function PlaceForm({ type, onSuccess }: PlaceFormProps) {
         />
       </div>
 
-      <div className="grid grid-cols-5 gap-4">
-        <div className="col-span-2">
+      <div className="grid grid-cols-3 gap-4">
+        <div className="flex items-end">
+          <button
+            type="button"
+            onClick={() => setShowMapPicker(true)}
+            className="w-full rounded-lg border border-white/10 bg-white/5 px-2 py-3 text-sm text-white/80 hover:bg-white/10 transition text-center leading-tight"
+          >
+            Указать<br />на карте
+          </button>
+        </div>
+        <div>
           <label className="mb-1 block text-sm text-white/60">Широта</label>
           <input
             type="number"
@@ -175,7 +184,7 @@ export default function PlaceForm({ type, onSuccess }: PlaceFormProps) {
             className="w-full rounded-lg border border-white/10 bg-white/5 px-3 py-3 text-white outline-none focus:border-green-500"
           />
         </div>
-        <div className="col-span-2">
+        <div>
           <label className="mb-1 block text-sm text-white/60">Долгота</label>
           <input
             type="number"
@@ -185,17 +194,6 @@ export default function PlaceForm({ type, onSuccess }: PlaceFormProps) {
             className="w-full rounded-lg border border-white/10 bg-white/5 px-3 py-3 text-white outline-none focus:border-green-500"
           />
         </div>
-        <div className="col-span-1 flex items-end">
-          <button
-            type="button"
-            onClick={() => setShowMapPicker(true)}
-            className="w-auto rounded-lg border border-white/10 bg-white/5 px-3 py-3 text-sm text-white/80 hover:bg-white/10 transition text-center whitespace-nowrap"
-          >
-            Указать на карте
-          </button>
-        </div>
-          />
-        </div>
       </div>
 
       <div>