Преглед на файлове

Revert "fix: OSM тайлы (дома, светлее), flex-раскладка кнопки, чёрный фон MapPicker, Nominatim error handling"

This reverts commit 9138213b9af9fa23bd0c3a62b95e89d96396ed4f.
neyrogovnarik преди 1 месец
родител
ревизия
b5ac85b9bc
променени са 3 файла, в които са добавени 13 реда и са изтрити 20 реда
  1. 6 13
      frontend/src/components/MapPicker.tsx
  2. 6 6
      frontend/src/components/PlaceForm.tsx
  3. 1 1
      frontend/src/lib/map.ts

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

@@ -21,7 +21,7 @@ export default function MapPicker({ onSelect, onClose }: MapPickerProps) {
     if (!mapRef.current || mapInstanceRef.current) return
 
     const map = L.map(mapRef.current, {
-      zoomControl: true,
+      zoomControl: false,
       attributionControl: false,
     }).setView([lat, lng], 14)
 
@@ -61,23 +61,16 @@ 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' } }
       )
-      if (res.ok) {
-        const data = await res.json()
-        if (data.display_name) {
-          onSelect(lat, lng, data.display_name)
-          return
-        }
-      }
+      const data = await res.json()
+      onSelect(lat, lng, data.display_name || undefined)
     } catch {
-      // игнорируем ошибку геокодирования
+      onSelect(lat, lng)
     }
-    onSelect(lat, lng)
   }
 
   return (
-    <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="fixed inset-0 z-[60] flex flex-col bg-black/80 backdrop-blur-sm">
+      <div ref={mapRef} className="flex-1" />
       <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)}

+ 6 - 6
frontend/src/components/PlaceForm.tsx

@@ -164,8 +164,8 @@ export default function PlaceForm({ type, onSuccess }: PlaceFormProps) {
         />
       </div>
 
-      <div className="flex gap-4">
-        <div className="flex-1">
+      <div className="grid grid-cols-5 gap-4">
+        <div className="col-span-2">
           <label className="mb-1 block text-sm text-white/60">Широта</label>
           <input
             type="number"
@@ -175,7 +175,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="flex-1">
+        <div className="col-span-2">
           <label className="mb-1 block text-sm text-white/60">Долгота</label>
           <input
             type="number"
@@ -185,13 +185,13 @@ 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="flex items-end">
+        <div className="col-span-1 flex items-end">
           <button
             type="button"
             onClick={() => setShowMapPicker(true)}
-            className="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"
+            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>

+ 1 - 1
frontend/src/lib/map.ts

@@ -18,7 +18,7 @@ export interface MarkerOptions {
   color?: string
 }
 
-const TILE_URL = 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
+const TILE_URL = 'https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png'
 const MARKER_COLORS: Record<string, string> = {
   place: '#FFF82A',
   studio: '#FF80DF',