From 7e539f550b39ca29f5905359063a1243e7369e3f Mon Sep 17 00:00:00 2001 From: itoshi Date: Tue, 19 May 2026 14:14:04 +0300 Subject: [PATCH] feat: hide search input when list is empty and add animated city selector highlight Co-Authored-By: Claude Opus 4.6 --- src/pages/Article/ArticleListPage/index.tsx | 4 +- src/pages/Carrier/CarrierListPage/index.tsx | 4 +- src/pages/City/CityListPage/index.tsx | 4 +- src/pages/Country/CountryListPage/index.tsx | 4 +- src/pages/Media/MediaListPage/index.tsx | 4 +- src/pages/Route/RouteListPage/index.tsx | 4 +- src/pages/Sight/SightListPage/index.tsx | 4 +- src/pages/Snapshot/SnapshotListPage/index.tsx | 4 +- src/pages/Station/StationListPage/index.tsx | 4 +- src/pages/User/UserListPage/index.tsx | 4 +- src/pages/Vehicle/VehicleListPage/index.tsx | 4 +- src/widgets/CitySelector/index.tsx | 117 ++++++++++++------ 12 files changed, 111 insertions(+), 50 deletions(-) diff --git a/src/pages/Article/ArticleListPage/index.tsx b/src/pages/Article/ArticleListPage/index.tsx index b3f3a3a..acb577a 100644 --- a/src/pages/Article/ArticleListPage/index.tsx +++ b/src/pages/Article/ArticleListPage/index.tsx @@ -108,7 +108,9 @@ export const ArticleListPage = observer(() => { )} - + {rows.length > 0 && ( + + )}
{
)} - + {rows.length > 0 && ( + + )} { )} - + {rows.length > 0 && ( + + )} { )} - + {rows.length > 0 && ( + + )} { return ( <>
- + {rows.length > 0 && ( + + )} {canWriteMedia && ids.length > 0 && (
diff --git a/src/pages/Route/RouteListPage/index.tsx b/src/pages/Route/RouteListPage/index.tsx index 652ad5e..c27a81f 100644 --- a/src/pages/Route/RouteListPage/index.tsx +++ b/src/pages/Route/RouteListPage/index.tsx @@ -271,7 +271,9 @@ export const RouteListPage = observer(() => {
)} - + {rows.length > 0 && ( + + )} {
)} - + {rows.length > 0 && ( + + )} { )} - + {rows.length > 0 && ( + + )} { )} - + {rows.length > 0 && ( + + )} { )} - + {rows.length > 0 && ( + + )} { /> - + {rows.length > 0 && ( + + )} {canWriteVehicles && ids.length > 0 && (
diff --git a/src/widgets/CitySelector/index.tsx b/src/widgets/CitySelector/index.tsx index 418fb34..6401149 100644 --- a/src/widgets/CitySelector/index.tsx +++ b/src/widgets/CitySelector/index.tsx @@ -6,11 +6,21 @@ import { SelectChangeEvent, Typography, Box, + keyframes, } from "@mui/material"; import { observer } from "mobx-react-lite"; import { authStore, cityStore, selectedCityStore, snapshotStore, type City } from "@shared"; import { MapPin } from "lucide-react"; +const borderSpin = keyframes` + 0% { + background-position: 0% 50%; + } + 100% { + background-position: 200% 50%; + } +`; + export const CitySelector: React.FC = observer(() => { const { selectedCity, setSelectedCity, isLocked } = selectedCityStore; const canLoadAllCities = authStore.isAdmin && authStore.canRead("cities"); @@ -43,6 +53,8 @@ export const CitySelector: React.FC = observer(() => { })() : baseCities; + const noCitySelected = !selectedCity?.id; + const handleCityChange = (event: SelectChangeEvent) => { const cityId = event.target.value; if (cityId === "") { @@ -58,49 +70,76 @@ export const CitySelector: React.FC = observer(() => { } }; + const selectElement = ( + + ); + return ( - + {noCitySelected && !isLocked ? ( + + {selectElement} + + ) : ( + selectElement + )} );