feat: update demo page + add city_id for media and articles

This commit is contained in:
2026-04-28 10:57:42 +03:00
parent 60c6840db4
commit 94f512e0e4
27 changed files with 499 additions and 222 deletions

View File

@@ -1,6 +1,6 @@
import { DataGrid, GridColDef, GridRenderCellParams } from "@mui/x-data-grid";
import { ruRU } from "@mui/x-data-grid/locales";
import { authStore, articlesStore, languageStore, SearchInput } from "@shared";
import { authStore, articlesStore, languageStore, SearchInput, selectedCityStore } from "@shared";
import { useEffect, useState, useMemo } from "react";
import { observer } from "mobx-react-lite";
import { Trash2, Eye, Minus } from "lucide-react";
@@ -75,14 +75,16 @@ export const ArticleListPage = observer(() => {
const rows = useMemo(() => {
const query = searchQuery.trim().toLowerCase();
const cityId = selectedCityStore.selectedCityId;
return articleList[language].data
.filter((article) => !query || (article.heading ?? "").toLowerCase().includes(query))
.filter((article) => !cityId || article.city_id === cityId)
.map((article) => ({
id: article.id,
heading: article.heading,
body: article.body,
}));
}, [articleList[language].data, searchQuery]);
}, [articleList[language].data, searchQuery, selectedCityStore.selectedCityId]);
return (
<>