fix: Update map with tables fixes
This commit is contained in:
		| @@ -1,10 +1,12 @@ | ||||
| import { DataGrid, GridColDef, GridRenderCellParams } from "@mui/x-data-grid"; | ||||
| import { ruRU } from "@mui/x-data-grid/locales"; | ||||
| import { languageStore, stationsStore } from "@shared"; | ||||
| import { useEffect, useState } from "react"; | ||||
| import { observer } from "mobx-react-lite"; | ||||
| import { Eye, Pencil, Trash2, Minus } from "lucide-react"; | ||||
| import { useNavigate } from "react-router-dom"; | ||||
| import { CreateButton, DeleteModal, LanguageSwitcher } from "@widgets"; | ||||
| import { Box, CircularProgress } from "@mui/material"; | ||||
|  | ||||
| export const StationListPage = observer(() => { | ||||
|   const { stationLists, getStationList, deleteStation } = stationsStore; | ||||
| @@ -13,10 +15,16 @@ export const StationListPage = observer(() => { | ||||
|   const [isBulkDeleteModalOpen, setIsBulkDeleteModalOpen] = useState(false); | ||||
|   const [rowId, setRowId] = useState<number | null>(null); | ||||
|   const [ids, setIds] = useState<number[]>([]); | ||||
|   const [isLoading, setIsLoading] = useState(false); | ||||
|   const { language } = languageStore; | ||||
|  | ||||
|   useEffect(() => { | ||||
|     getStationList(); | ||||
|     const fetchStations = async () => { | ||||
|       setIsLoading(true); | ||||
|       await getStationList(); | ||||
|       setIsLoading(false); | ||||
|     }; | ||||
|     fetchStations(); | ||||
|   }, [language]); | ||||
|  | ||||
|   const columns: GridColDef[] = [ | ||||
| @@ -115,7 +123,7 @@ export const StationListPage = observer(() => { | ||||
|       <div className="w-full"> | ||||
|         <div className="flex justify-between items-center mb-10"> | ||||
|           <h1 className="text-2xl">Станции</h1> | ||||
|           <CreateButton label="Создать станцию" path="/station/create" /> | ||||
|           <CreateButton label="Создать остановки" path="/station/create" /> | ||||
|         </div> | ||||
|  | ||||
|         <div | ||||
| @@ -136,10 +144,19 @@ export const StationListPage = observer(() => { | ||||
|           columns={columns} | ||||
|           hideFooterPagination | ||||
|           checkboxSelection | ||||
|           loading={isLoading} | ||||
|           onRowSelectionModelChange={(newSelection) => { | ||||
|             setIds(Array.from(newSelection.ids) as number[]); | ||||
|           }} | ||||
|           hideFooter | ||||
|           localeText={ruRU.components.MuiDataGrid.defaultProps.localeText} | ||||
|           slots={{ | ||||
|             noRowsOverlay: () => ( | ||||
|               <Box sx={{ mt: 5, textAlign: "center", color: "text.secondary" }}> | ||||
|                 {isLoading ? <CircularProgress size={20} /> : "Нет станций"} | ||||
|               </Box> | ||||
|             ), | ||||
|           }} | ||||
|         /> | ||||
|       </div> | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user