fix: Fix webp + delete ctrl z + filter by city

This commit is contained in:
2025-10-06 10:03:41 +03:00
parent 26e4d70b95
commit 4bcc2e2cca
7 changed files with 65 additions and 309 deletions

View File

@@ -1,7 +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 {
languageStore,
stationsStore,
selectedCityStore,
cityStore,
} from "@shared";
import { useEffect, useState, useMemo } from "react";
import { observer } from "mobx-react-lite";
import { Eye, Pencil, Trash2, Minus } from "lucide-react";
import { useNavigate } from "react-router-dom";
@@ -21,6 +26,7 @@ export const StationListPage = observer(() => {
useEffect(() => {
const fetchStations = async () => {
setIsLoading(true);
await cityStore.getCities(language);
await getStationList();
setIsLoading(false);
};
@@ -109,7 +115,18 @@ export const StationListPage = observer(() => {
},
];
const rows = stationLists[language].data.map((station: any) => ({
// Фильтрация станций по выбранному городу
const filteredStations = useMemo(() => {
const { selectedCityId } = selectedCityStore;
if (!selectedCityId) {
return stationLists[language].data;
}
return stationLists[language].data.filter(
(station: any) => station.city_id === selectedCityId
);
}, [stationLists, language, selectedCityStore.selectedCityId]);
const rows = filteredStations.map((station: any) => ({
id: station.id,
name: station.name,
system_name: station.system_name,