Răsfoiți Sursa

feat: unified scrollbar style, make address/description/coordinates required

neyrogovnarik 1 lună în urmă
părinte
comite
1b19c2e298
2 a modificat fișierele cu 22 adăugiri și 9 ștergeri
  1. 19 6
      frontend/src/components/PlaceForm.tsx
  2. 3 3
      frontend/src/styles/globals.css

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

@@ -81,6 +81,15 @@ export default function PlaceForm({ type, onSuccess, place }: PlaceFormProps) {
         coverImage = res.file_url
       }
 
+      if (!description.trim()) {
+        setError('Укажите описание')
+        return
+      }
+      if (!address.trim()) {
+        setError('Укажите адрес')
+        return
+      }
+
       const parsedLat = parseFloat(lat)
       const parsedLng = parseFloat(lng)
       if (isNaN(parsedLat) || isNaN(parsedLng)) {
@@ -90,8 +99,8 @@ export default function PlaceForm({ type, onSuccess, place }: PlaceFormProps) {
 
       const body: Record<string, unknown> = {
         title,
-        description: description || undefined,
-        address: address || undefined,
+        description: description.trim(),
+        address: address.trim(),
         lat: parsedLat,
         lng: parsedLng,
         access_info: accessInfo || undefined,
@@ -173,42 +182,46 @@ export default function PlaceForm({ type, onSuccess, place }: PlaceFormProps) {
       </div>
 
       <div>
-        <label className="mb-1 block text-sm text-white/60">Описание</label>
+        <label className="mb-1 block text-sm text-white/60">Описание *</label>
         <textarea
           value={description}
           onChange={(e) => setDescription(e.target.value)}
           rows={4}
+          required
           className="w-full rounded-lg border border-white/10 bg-white/5 px-4 py-3 text-white outline-none focus:border-green-500"
         />
       </div>
 
       <div>
-        <label className="mb-1 block text-sm text-white/60">Адрес</label>
+        <label className="mb-1 block text-sm text-white/60">Адрес *</label>
         <input
           value={address}
           onChange={(e) => setAddress(e.target.value)}
+          required
           className="w-full rounded-lg border border-white/10 bg-white/5 px-4 py-3 text-white outline-none focus:border-green-500"
         />
       </div>
 
       <div className="grid grid-cols-5 gap-4">
         <div className="col-span-2">
-          <label className="mb-1 block text-sm text-white/60">Широта</label>
+          <label className="mb-1 block text-sm text-white/60">Широта *</label>
           <input
             type="number"
             step="any"
             value={lat}
             onChange={(e) => setLat(e.target.value)}
+            required
             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">
-          <label className="mb-1 block text-sm text-white/60">Долгота</label>
+          <label className="mb-1 block text-sm text-white/60">Долгота *</label>
           <input
             type="number"
             step="any"
             value={lng}
             onChange={(e) => setLng(e.target.value)}
+            required
             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>

+ 3 - 3
frontend/src/styles/globals.css

@@ -39,15 +39,15 @@ body {
 }
 
 ::-webkit-scrollbar-thumb {
-  background: var(--color-surface);
+  background: #475569;
   border-radius: 4px;
 }
 
 ::-webkit-scrollbar-thumb:hover {
-  background: #475569;
+  background: #64748b;
 }
 
 * {
   scrollbar-width: thin;
-  scrollbar-color: var(--color-surface) transparent;
+  scrollbar-color: #475569 transparent;
 }