diff --git a/.env b/.env index c8ded82..c554530 100644 --- a/.env +++ b/.env @@ -1,8 +1,8 @@ -# VITE_API_URL='https://wn.st.unprism.ru' -# VITE_REACT_APP ='https://wn.st.unprism.ru/' -# VITE_KRBL_MEDIA='https://wn.st.unprism.ru/media/' -# VITE_NEED_AUTH='true' -VITE_API_URL='https://wn.krbl.ru' -VITE_REACT_APP ='https://wn.krbl.ru/' -VITE_KRBL_MEDIA='https://wn.krbl.ru/media/' +VITE_API_URL='https://wn.st.unprism.ru' +VITE_REACT_APP ='https://wn.st.unprism.ru/' +VITE_KRBL_MEDIA='https://wn.st.unprism.ru/media/' VITE_NEED_AUTH='true' +# VITE_API_URL='https://wn.krbl.ru' +# VITE_REACT_APP ='https://wn.krbl.ru/' +# VITE_KRBL_MEDIA='https://wn.krbl.ru/media/' +# VITE_NEED_AUTH='true' diff --git a/src/client/src/components/ListOfSights/SightFrame.jsx b/src/client/src/components/ListOfSights/SightFrame.jsx index f10a744..97f7fcd 100644 --- a/src/client/src/components/ListOfSights/SightFrame.jsx +++ b/src/client/src/components/ListOfSights/SightFrame.jsx @@ -47,7 +47,7 @@ const SightFrame = observer(({ media, sight_id, sight_name }) => { const textWrapperRef = useRef(null); - // Автозакрытие fullscreen 3D при бездействии (45 сек) + // Автозакрытие fullscreen 3D при бездействии (60 сек) useEffect(() => { if (!isFullscreen3D) { if (idleTimerRef.current) { @@ -61,7 +61,7 @@ const SightFrame = observer(({ media, sight_id, sight_name }) => { const checkIdle = () => { idleSeconds += 1; - if (idleSeconds >= 45) { + if (idleSeconds >= 60) { setIsFullscreen3D(false); } }; diff --git a/src/client/src/components/side-menu/SideMenu.jsx b/src/client/src/components/side-menu/SideMenu.jsx index fff6c01..a575323 100644 --- a/src/client/src/components/side-menu/SideMenu.jsx +++ b/src/client/src/components/side-menu/SideMenu.jsx @@ -264,15 +264,20 @@ const SideMenu = observer(({ onMenuToggle }) => { } }; + const isMenuOpenRef = useRef(isMenuOpen); + const handleMenuToggleRef = useRef(handleMenuToggle); + useEffect(() => { isMenuOpenRef.current = isMenuOpen; }, [isMenuOpen]); + useEffect(() => { handleMenuToggleRef.current = handleMenuToggle; }); + useEffect(() => { - // Автоматическое закрытие сайд-меню после 45 секунд бездействия + // Автоматическое закрытие сайд-меню после 60 секунд бездействия let idleSeconds = 0; const checkIdle = () => { idleSeconds += 1; - if (idleSeconds >= 45 && isMenuOpen) { - handleMenuToggle(false); + if (idleSeconds >= 60 && isMenuOpenRef.current) { + handleMenuToggleRef.current(false); } }; @@ -301,7 +306,7 @@ const SideMenu = observer(({ onMenuToggle }) => { window.removeEventListener(event, resetIdle); }); }; - }, [isMenuOpen, handleMenuToggle]); + }, []); // Закрываем и открываем список достопримечательностей при изменении сортировки const prevSortingByRef = useRef(sortingBy); diff --git a/src/client/src/styles/RouteWidget.css b/src/client/src/styles/RouteWidget.css index 3aaac09..b1b0992 100644 --- a/src/client/src/styles/RouteWidget.css +++ b/src/client/src/styles/RouteWidget.css @@ -52,7 +52,8 @@ height: 96px; background-color: #fcd500; color: black; - border-radius: 10px; + border-top-left-radius: 10px; + border-bottom-left-radius: 10px; display: flex; justify-content: center; align-items: center; diff --git a/src/pages/Article/ArticleListPage/index.tsx b/src/pages/Article/ArticleListPage/index.tsx index 559c86b..63d8f4c 100644 --- a/src/pages/Article/ArticleListPage/index.tsx +++ b/src/pages/Article/ArticleListPage/index.tsx @@ -31,7 +31,7 @@ export const ArticleListPage = observer(() => { setIsLoading(false); }; fetchArticles(); - }, [language]); + }, [language, selectedCityStore.cityVersion]); const columns: GridColDef[] = [ { diff --git a/src/pages/Carrier/CarrierListPage/index.tsx b/src/pages/Carrier/CarrierListPage/index.tsx index 5cf0647..80cbc9e 100644 --- a/src/pages/Carrier/CarrierListPage/index.tsx +++ b/src/pages/Carrier/CarrierListPage/index.tsx @@ -1,6 +1,6 @@ import { DataGrid, GridColDef, GridRenderCellParams } from "@mui/x-data-grid"; import { ruRU } from "@mui/x-data-grid/locales"; -import { authStore, carrierStore, cityStore, languageStore, SearchInput } from "@shared"; +import { authStore, carrierStore, cityStore, languageStore, selectedCityStore, SearchInput } from "@shared"; import { useEffect, useState, useMemo } from "react"; import { observer } from "mobx-react-lite"; import { Pencil, Trash2, Minus } from "lucide-react"; @@ -39,7 +39,7 @@ export const CarrierListPage = observer(() => { setIsLoading(false); }; fetchData(); - }, [language]); + }, [language, selectedCityStore.cityVersion]); const columns: GridColDef[] = [ { @@ -169,6 +169,11 @@ export const CarrierListPage = observer(() => { checkboxSelection={canWriteCarriers} disableRowSelectionExcludeModel disableRowSelectionOnClick + onRowDoubleClick={(params) => { + if (canWriteCarriers) { + navigate(`/carrier/${params.id}/edit`); + } + }} loading={isLoading} paginationModel={paginationModel} onPaginationModelChange={setPaginationModel} diff --git a/src/pages/City/CityListPage/index.tsx b/src/pages/City/CityListPage/index.tsx index afbab5f..7c6ecb0 100644 --- a/src/pages/City/CityListPage/index.tsx +++ b/src/pages/City/CityListPage/index.tsx @@ -172,6 +172,11 @@ export const CityListPage = observer(() => { checkboxSelection={canWriteCities} disableRowSelectionExcludeModel disableRowSelectionOnClick + onRowDoubleClick={(params) => { + if (canWriteCities) { + navigate(`/city/${params.id}/edit`); + } + }} loading={isLoading} paginationModel={paginationModel} onPaginationModelChange={setPaginationModel} diff --git a/src/pages/CreateSightPage/index.tsx b/src/pages/CreateSightPage/index.tsx index 7f6729f..80f7d7b 100644 --- a/src/pages/CreateSightPage/index.tsx +++ b/src/pages/CreateSightPage/index.tsx @@ -15,6 +15,7 @@ import { } from "@widgets"; import { useEffect, useState } from "react"; import { observer } from "mobx-react-lite"; +import { runInAction } from "mobx"; function a11yProps(index: number) { return { @@ -36,6 +37,16 @@ export const CreateSightPage = observer(() => { return () => selectedCityStore.setIsLocked(false); }, []); + useEffect(() => { + const { selectedCityId, selectedCity } = selectedCityStore; + if (selectedCityId && selectedCity && !createSightStore.sight.city_id) { + runInAction(() => { + createSightStore.sight.city_id = selectedCityId; + createSightStore.sight.city = selectedCity.name; + }); + } + }, []); + const handleChange = (_: React.SyntheticEvent, newValue: number) => { setValue(newValue); }; diff --git a/src/pages/Route/RouteListPage/index.tsx b/src/pages/Route/RouteListPage/index.tsx index 712203f..d80ca31 100644 --- a/src/pages/Route/RouteListPage/index.tsx +++ b/src/pages/Route/RouteListPage/index.tsx @@ -43,7 +43,7 @@ export const RouteListPage = observer(() => { loadCounts(routeIds); }; fetchData(); - }, [language]); + }, [language, selectedCityStore.cityVersion]); const columns: GridColDef[] = [ { diff --git a/src/pages/Route/route-preview/Station.tsx b/src/pages/Route/route-preview/Station.tsx index 555512f..9944e85 100644 --- a/src/pages/Route/route-preview/Station.tsx +++ b/src/pages/Route/route-preview/Station.tsx @@ -448,6 +448,22 @@ const StationLabel = observer( anchor={dynamicAnchor} zIndex={isHovered || isControlHovered ? 1000 : 0} > + {ruLabelWidth > 0 && ( + { + g.clear(); + const hasSecondLabel = !!(station.name && language !== "ru" && ruLabel); + const pad = 10 / scale; + const w = ruLabelWidth + pad * 2; + const top = -compensatedRuFontSize / 2 - pad; + const bottom = hasSecondLabel + ? compensatedRuFontSize * 1.1 + compensatedNameFontSize / 2 + pad + : compensatedRuFontSize / 2 + pad; + g.rect(-w / 2, top, w, bottom - top); + g.fill({ color: 0x000000, alpha: 0.001 }); + }} + /> + )} {ruLabel && ( { resizingStationIconId === station.id; const secondaryLineHeight = 1.2; - const secondaryHeight = showSecondary - ? secondaryFontSize * secondaryLineHeight - : 0; - const menuPaddingTop = showSecondary - ? Math.max(0, secondaryHeight - secondaryMarginTop) + 3 - : 3; return (
@@ -2440,22 +2434,25 @@ export const WebGLRouteMapPrototype = observer(() => { color: "#fff", fontFamily: "Roboto, sans-serif", textAlign: "left", - pointerEvents: "auto", + pointerEvents: "none", cursor: "grab", userSelect: "none", touchAction: "none", + lineHeight: 1, }} >
{ ) : null}
{station.name} + {showSecondary ? ( +
+ {secondaryStation?.name} +
+ ) : null}
- {showSecondary ? ( -
- {secondaryStation?.name} -
- ) : null}
@@ -2587,9 +2586,9 @@ export const WebGLRouteMapPrototype = observer(() => { top: "100%", left: "50%", transform: "translateX(-50%)", - paddingTop: menuPaddingTop, + paddingTop: "8px", pointerEvents: "auto", - zIndex: 10, + zIndex: 1000000, cursor: "default", }} onPointerDown={(e) => e.stopPropagation()} diff --git a/src/pages/Sight/SightListPage/index.tsx b/src/pages/Sight/SightListPage/index.tsx index ec54204..748078f 100644 --- a/src/pages/Sight/SightListPage/index.tsx +++ b/src/pages/Sight/SightListPage/index.tsx @@ -46,7 +46,7 @@ export const SightListPage = observer(() => { setIsLoading(false); }; fetchSights(); - }, [language]); + }, [language, selectedCityStore.cityVersion]); const columns: GridColDef[] = [ { diff --git a/src/pages/Station/StationListPage/index.tsx b/src/pages/Station/StationListPage/index.tsx index ef7f586..51990c5 100644 --- a/src/pages/Station/StationListPage/index.tsx +++ b/src/pages/Station/StationListPage/index.tsx @@ -49,7 +49,7 @@ export const StationListPage = observer(() => { loadSightCounts(stationIds); }; fetchStations(); - }, [language]); + }, [language, selectedCityStore.cityVersion]); const columns: GridColDef[] = [ { diff --git a/src/pages/Vehicle/VehicleCreatePage/index.tsx b/src/pages/Vehicle/VehicleCreatePage/index.tsx index 0dff141..4d8b386 100644 --- a/src/pages/Vehicle/VehicleCreatePage/index.tsx +++ b/src/pages/Vehicle/VehicleCreatePage/index.tsx @@ -12,6 +12,8 @@ import { VEHICLE_TYPES, carrierStore, languageStore, + cityStore, + selectedCityStore, } from "@shared"; import { observer } from "mobx-react-lite"; import { ArrowLeft, Save } from "lucide-react"; @@ -26,11 +28,13 @@ export const VehicleCreatePage = observer(() => { const [type, setType] = useState(""); const [carrierId, setCarrierId] = useState(null); const [model, setModel] = useState(""); + const [cityId, setCityId] = useState(selectedCityStore.selectedCityId); const [isLoading, setIsLoading] = useState(false); const { language } = languageStore; useEffect(() => { carrierStore.getCarriers(language); + cityStore.getCities("ru"); }, [language]); const handleCreate = async () => { @@ -43,6 +47,7 @@ export const VehicleCreatePage = observer(() => { ?.full_name as string, carrierId!, model || undefined, + cityId ?? undefined, ); toast.success("Транспорт успешно создан"); } catch (error) { @@ -73,12 +78,11 @@ export const VehicleCreatePage = observer(() => { onChange={(e) => setTailNumber(e.target.value)} /> - + Тип - + Перевозчик setCityId(e.target.value ? Number(e.target.value) : null)} + > + {cityStore.cities.ru.data.map((city) => ( + + {city.name} + + ))} + + +