Explorar el Código

show toast 'Сохранено' after PlaceEditModal closes

Modal closes on save, green toast appears for 3 seconds, places list refreshes.
neyrogovnarik hace 1 mes
padre
commit
dd6bea798c
Se han modificado 1 ficheros con 4 adiciones y 1 borrados
  1. 4 1
      frontend/src/app/places/my/page.tsx

+ 4 - 1
frontend/src/app/places/my/page.tsx

@@ -262,6 +262,7 @@ export default function MyPlacesPage() {
   const [loading, setLoading] = useState(true)
   const [editId, setEditId] = useState<string | null>(null)
   const [filter, setFilter] = useState('all')
+  const [toast, setToast] = useState('')
 
   const fetchPlaces = () => {
     setLoading(true)
@@ -278,6 +279,8 @@ export default function MyPlacesPage() {
       <div className="mx-auto max-w-3xl px-4">
         <h1 className="mb-6 text-2xl font-bold text-white">Мои места</h1>
 
+        {toast && <p className="mb-4 rounded-lg bg-green-500/15 px-4 py-3 text-sm text-green-400 text-center font-medium">{toast}</p>}
+
         <div className="mb-6 flex flex-wrap gap-2">
           {FILTERS.map((f) => {
             const count = f.key === 'all' ? places.length : places.filter((p) => p.status === f.key).length
@@ -338,7 +341,7 @@ export default function MyPlacesPage() {
       </div>
 
       {editId && (
-        <PlaceEditModal placeId={editId} onClose={() => setEditId(null)} onSaved={() => { setEditId(null); fetchPlaces() }} />
+        <PlaceEditModal placeId={editId} onClose={() => setEditId(null)} onSaved={() => { setEditId(null); setToast('Сохранено'); setTimeout(() => setToast(''), 3000); fetchPlaces() }} />
       )}
     </div>
   )