From d4c5db61ead60f395d4b2749e26c059acf196a9b Mon Sep 17 00:00:00 2001 From: itoshi Date: Mon, 25 May 2026 12:46:53 +0300 Subject: [PATCH] feat: add markdown, lang atribute, button_text --- package.json | 2 +- src/client/src/api/ApiStore/types.ts | 1 + .../src/components/TouchableLayout/index.tsx | 35 +++++++-- .../src/components/side-menu/LeftWidget.jsx | 75 +++---------------- .../src/components/side-menu/SideMenu.jsx | 12 +-- .../src/components/side-menu/SightsList.jsx | 18 ++++- .../src/components/widgets/AppealWidget.jsx | 5 +- .../src/components/widgets/ThreeView.tsx | 2 +- src/client/src/index.css | 4 +- src/client/src/styles/AppealWidget.css | 61 ++++++++++++++- src/client/src/styles/LeftWidget.css | 71 ++++++++++++++++-- src/client/src/styles/ListOfSights.css | 39 +++++++--- src/client/src/styles/SideMenu.css | 13 +++- src/client/src/styles/TouchableLayout.css | 2 + src/pages/Article/ArticleListPage/index.tsx | 2 +- src/pages/Carrier/CarrierListPage/index.tsx | 2 +- src/pages/City/CityListPage/index.tsx | 2 +- src/pages/Country/CountryListPage/index.tsx | 2 +- src/pages/Media/MediaListPage/index.tsx | 2 +- src/pages/Route/RouteCreatePage/index.tsx | 17 +++++ src/pages/Route/RouteEditPage/index.tsx | 16 ++++ src/pages/Route/RouteListPage/index.tsx | 2 +- src/pages/Route/route-preview/types.ts | 1 + src/pages/Sight/SightListPage/index.tsx | 2 +- src/pages/Snapshot/SnapshotListPage/index.tsx | 2 +- src/pages/Station/StationListPage/index.tsx | 2 +- src/pages/User/UserListPage/index.tsx | 2 +- src/pages/Vehicle/VehicleListPage/index.tsx | 2 +- src/shared/store/RouteStore/index.ts | 2 + 29 files changed, 281 insertions(+), 117 deletions(-) diff --git a/package.json b/package.json index d44c7bb..ca4feb4 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "white-nights", "private": true, - "version": "1.0.7", + "version": "1.0.8", "type": "module", "license": "UNLICENSED", "scripts": { diff --git a/src/client/src/api/ApiStore/types.ts b/src/client/src/api/ApiStore/types.ts index 4baab33..d5d1962 100644 --- a/src/client/src/api/ApiStore/types.ts +++ b/src/client/src/api/ApiStore/types.ts @@ -55,6 +55,7 @@ export type GetRouteResponse = { center_latitude: number; center_longitude: number; governor_appeal: number; + button_text?: string; id: number; path: [number, number][]; rotate: number; diff --git a/src/client/src/components/TouchableLayout/index.tsx b/src/client/src/components/TouchableLayout/index.tsx index 0d936d7..027d4d8 100644 --- a/src/client/src/components/TouchableLayout/index.tsx +++ b/src/client/src/components/TouchableLayout/index.tsx @@ -20,6 +20,8 @@ function useThumbSync(scrollableRef: React.RefObject) { top: 0, hasScroll: false, }); + const [visible, setVisible] = useState(false); + const hideTimerRef = useRef | null>(null); const rafRef = useRef(null); const update = useCallback(() => { @@ -32,7 +34,7 @@ function useThumbSync(scrollableRef: React.RefObject) { const th = ch; if (sh <= ch) { - setState({ height: th, top: 0, hasScroll: false }); + setState((prev) => ({ ...prev, hasScroll: false })); return; } @@ -68,7 +70,24 @@ function useThumbSync(scrollableRef: React.RefObject) { }; }, [update]); - return state; + useEffect(() => { + if (state.hasScroll) { + if (hideTimerRef.current) { + clearTimeout(hideTimerRef.current); + hideTimerRef.current = null; + } + setVisible(true); + } else { + hideTimerRef.current = setTimeout(() => { + setVisible(false); + }, 200); + } + return () => { + if (hideTimerRef.current) clearTimeout(hideTimerRef.current); + }; + }, [state.hasScroll]); + + return { ...state, visible }; } export const TouchableLayout = forwardRef( @@ -251,15 +270,19 @@ export const TouchableLayout = forwardRef(
{children}
- {thumb.hasScroll && ( -
+
+ {thumb.visible && (
-
- )} + )} +
); diff --git a/src/client/src/components/side-menu/LeftWidget.jsx b/src/client/src/components/side-menu/LeftWidget.jsx index deefd5e..079c7c1 100644 --- a/src/client/src/components/side-menu/LeftWidget.jsx +++ b/src/client/src/components/side-menu/LeftWidget.jsx @@ -5,6 +5,8 @@ import { useGeolocationStore } from "../../stores"; import "../../styles/LeftWidget.css"; import { apiStore } from "../../api/ApiStore/store"; import { apiBaseURL } from "../../api/apiConfig"; +import { ReactMarkdownComponent } from "../ReactMarkdown"; +import { TouchableLayout } from "../TouchableLayout"; const LeftWidget = observer( ({ selectedSightId, onClose, isVisible, sightTop }) => { @@ -15,8 +17,7 @@ const LeftWidget = observer( const [isImageLoaded, setIsImageLoaded] = useState(false); const [widgetHeight, setWidgetHeight] = useState(0); - const textRef = useRef(null); - const activeTouch = useRef(null); + const layoutRef = useRef(null); const widgetRef = useRef(null); const store = useGeolocationStore(); @@ -37,64 +38,10 @@ const LeftWidget = observer( }, [selectedSightData, isImageLoaded, isVisible, isLoading, error]); useEffect(() => { - const scrollContainer = textRef.current; - if (!scrollContainer) return; - - const handleTouchStart = (e) => { - e.stopPropagation(); - if (e.touches.length === 1) { - activeTouch.current = { - identifier: e.touches[0].identifier, - lastY: e.touches[0].clientY, - }; - } - }; - - const handleTouchMove = (e) => { - e.preventDefault(); - if (activeTouch.current) { - for (const touch of e.changedTouches) { - if (touch.identifier === activeTouch.current.identifier) { - const deltaY = touch.clientY - activeTouch.current.lastY; - scrollContainer.scrollTop -= deltaY; - activeTouch.current.lastY = touch.clientY; - break; - } - } - } - }; - - const handleTouchEnd = (e) => { - for (const touch of e.changedTouches) { - if ( - activeTouch.current && - touch.identifier === activeTouch.current.identifier - ) { - activeTouch.current = null; - break; - } - } - }; - - scrollContainer.addEventListener("touchstart", handleTouchStart, { - passive: true, - }); - scrollContainer.addEventListener("touchmove", handleTouchMove, { - passive: false, - }); - scrollContainer.addEventListener("touchend", handleTouchEnd, { - passive: true, - }); - scrollContainer.addEventListener("touchcancel", handleTouchEnd, { - passive: true, - }); - - return () => { - scrollContainer.removeEventListener("touchstart", handleTouchStart); - scrollContainer.removeEventListener("touchmove", handleTouchMove); - scrollContainer.removeEventListener("touchend", handleTouchEnd); - scrollContainer.removeEventListener("touchcancel", handleTouchEnd); - }; + if (layoutRef.current) { + const scrollable = layoutRef.current.querySelector(".scrollable"); + if (scrollable) scrollable.scrollTop = 0; + } }, [selectedSightData]); useEffect(() => { @@ -238,9 +185,11 @@ const LeftWidget = observer(
{selectedSightData.address}
-
- {selectedSightData.text} -
+ +
+ +
+
) : (isVisible || selectedSightData) && !isLoading ? ( diff --git a/src/client/src/components/side-menu/SideMenu.jsx b/src/client/src/components/side-menu/SideMenu.jsx index 76dd651..ee73562 100644 --- a/src/client/src/components/side-menu/SideMenu.jsx +++ b/src/client/src/components/side-menu/SideMenu.jsx @@ -447,11 +447,13 @@ const SideMenu = observer(({ onMenuToggle }) => { }} className="appeal-button" > - {selectedLanguage == "ru" - ? "Обращение губернатора" - : selectedLanguage == "zh" - ? "州长致辞" - : "Governor's appeal"} + {route?.button_text + ? route.button_text + : selectedLanguage == "ru" + ? "Обращение губернатора" + : selectedLanguage == "zh" + ? "州长致辞" + : "Governor's appeal"} )}
0 ? '40px' : '260px' }}> diff --git a/src/client/src/components/side-menu/SightsList.jsx b/src/client/src/components/side-menu/SightsList.jsx index f600bcb..f70c63b 100644 --- a/src/client/src/components/side-menu/SightsList.jsx +++ b/src/client/src/components/side-menu/SightsList.jsx @@ -84,6 +84,12 @@ const SightItem = ({ return () => window.removeEventListener("resize", checkWidth); }, [sightName]); + useEffect(() => { + if (localSelectedSightId !== sight.id) { + setIsExpanded(false); + } + }, [localSelectedSightId, sight.id]); + const handleClick = (e) => { const newExpanded = !isExpanded; setIsExpanded(newExpanded); @@ -96,15 +102,19 @@ const SightItem = ({ const stations = sightStationsCache.get(cacheKey) || []; return ( -
+
handlePointerDown(e, sight.id)} onPointerUp={(e) => handlePointerUp(e, sight.id, handleClick)} - className={`side-menu-sight pointer ${ - localSelectedSightId === sight.id ? "selected" : "" - }`} + className="side-menu-sight pointer" > {sightName} diff --git a/src/client/src/components/widgets/AppealWidget.jsx b/src/client/src/components/widgets/AppealWidget.jsx index 497e9fa..06c91cb 100644 --- a/src/client/src/components/widgets/AppealWidget.jsx +++ b/src/client/src/components/widgets/AppealWidget.jsx @@ -1,6 +1,7 @@ import { useRef, useEffect } from "react"; import "../../styles/AppealWidget.css"; import { TouchableLayout } from "../TouchableLayout"; +import { ReactMarkdownComponent } from "../ReactMarkdown"; function AppealWidget({ widgetImgPath, @@ -38,7 +39,9 @@ function AppealWidget({ ref={layoutRef} className="dynamic-widget-text-scroll" > -
{widgetText}
+
+ +
); diff --git a/src/client/src/components/widgets/ThreeView.tsx b/src/client/src/components/widgets/ThreeView.tsx index 3eaaf41..2a4c634 100644 --- a/src/client/src/components/widgets/ThreeView.tsx +++ b/src/client/src/components/widgets/ThreeView.tsx @@ -288,7 +288,7 @@ export const ThreeView: React.FC = ({ {!isReady && (
)} diff --git a/src/client/src/index.css b/src/client/src/index.css index eeaf307..a789f1e 100644 --- a/src/client/src/index.css +++ b/src/client/src/index.css @@ -14,9 +14,9 @@ .side-menu-sights-block { height: calc(60%); overflow-y: scroll; - margin-left: 20px; + margin-left: 0; margin-top: 8px; - margin-right: 5px; + padding-right: 5px; touch-action: none; /* Отключаем стандартные действия */ overscroll-behavior: contain; /* Предотвращаем прокрутку родительских элементов */ } diff --git a/src/client/src/styles/AppealWidget.css b/src/client/src/styles/AppealWidget.css index 3ed9884..c4de46d 100644 --- a/src/client/src/styles/AppealWidget.css +++ b/src/client/src/styles/AppealWidget.css @@ -66,8 +66,63 @@ .dynamic-widget-text { - font-size: 14px; - font-weight: 400; - line-height: 190%; + font-size: 16px; + font-weight: 300; + line-height: 135%; padding-right: 5px; } + +.dynamic-widget-text .react-markdown-container { + font-size: 16px; + line-height: 135%; + font-weight: 300; +} + +.dynamic-widget-text .react-markdown-container p { + font-size: 16px; + line-height: 135%; + margin-bottom: 8px; +} + +.dynamic-widget-text .react-markdown-container p:last-child { + margin-bottom: 0; +} + +.dynamic-widget-text .react-markdown-container h1, +.dynamic-widget-text .react-markdown-container h2, +.dynamic-widget-text .react-markdown-container h3, +.dynamic-widget-text .react-markdown-container h4, +.dynamic-widget-text .react-markdown-container h5, +.dynamic-widget-text .react-markdown-container h6 { + font-size: 18px; + margin-top: 10px; + margin-bottom: 4px; + font-weight: 600; +} + +.dynamic-widget-text .react-markdown-container ul, +.dynamic-widget-text .react-markdown-container ol { + margin-bottom: 8px; + padding-left: 20px; +} + +.dynamic-widget-text .react-markdown-container li { + margin-bottom: 4px; +} + +.dynamic-widget-text .react-markdown-container blockquote { + margin-top: 8px; + margin-bottom: 8px; + padding-left: 12px; + border-left: 3px solid rgba(255, 255, 255, 0.4); +} + +.dynamic-widget-text .react-markdown-container img { + max-width: 100%; + border-radius: 6px; +} + +.dynamic-widget-text .react-markdown-container a { + color: rgba(255, 255, 255, 0.9); + text-decoration: underline; +} diff --git a/src/client/src/styles/LeftWidget.css b/src/client/src/styles/LeftWidget.css index 1cae8e3..b0cc157 100644 --- a/src/client/src/styles/LeftWidget.css +++ b/src/client/src/styles/LeftWidget.css @@ -67,17 +67,78 @@ line-height: 150%; } -.left-widget-text { +.left-widget-text-scroll.scrollable-container { margin-top: 15px; + overflow: hidden; + width: 100%; +} + +.left-widget-text-scroll .scrollable-viewport { + max-height: 200px; +} + +.left-widget-text { color: #fff; font-family: "Roboto"; font-size: 16px; font-weight: 300; line-height: 135%; - max-height: 200px; /* Пример ограничения высоты */ - overflow-y: auto; - touch-action: none; - overscroll-behavior: contain; + padding-right: 3px; +} + +.left-widget-text .react-markdown-container { + font-size: 16px; + line-height: 135%; + font-weight: 300; +} + +.left-widget-text .react-markdown-container p { + font-size: 16px; + line-height: 135%; + margin-bottom: 8px; +} + +.left-widget-text .react-markdown-container p:last-child { + margin-bottom: 0; +} + +.left-widget-text .react-markdown-container h1, +.left-widget-text .react-markdown-container h2, +.left-widget-text .react-markdown-container h3, +.left-widget-text .react-markdown-container h4, +.left-widget-text .react-markdown-container h5, +.left-widget-text .react-markdown-container h6 { + font-size: 18px; + margin-top: 10px; + margin-bottom: 4px; + font-weight: 600; +} + +.left-widget-text .react-markdown-container ul, +.left-widget-text .react-markdown-container ol { + margin-bottom: 8px; + padding-left: 20px; +} + +.left-widget-text .react-markdown-container li { + margin-bottom: 4px; +} + +.left-widget-text .react-markdown-container blockquote { + margin-top: 8px; + margin-bottom: 8px; + padding-left: 12px; + border-left: 3px solid rgba(255, 255, 255, 0.4); +} + +.left-widget-text .react-markdown-container img { + max-width: 100%; + border-radius: 6px; +} + +.left-widget-text .react-markdown-container a { + color: rgba(255, 255, 255, 0.9); + text-decoration: underline; } .left-widget-image { diff --git a/src/client/src/styles/ListOfSights.css b/src/client/src/styles/ListOfSights.css index 1649fac..cb190fd 100644 --- a/src/client/src/styles/ListOfSights.css +++ b/src/client/src/styles/ListOfSights.css @@ -1,8 +1,16 @@ @keyframes pulse-chevron { - 0% { transform: rotate(var(--r, 0deg)) translateY(0px) scale(1); } - 40% { transform: rotate(var(--r, 0deg)) translateY(-4px) scale(1.12); } - 60% { transform: rotate(var(--r, 0deg)) translateY(-5px) scale(1.14); } - 100% { transform: rotate(var(--r, 0deg)) translateY(0px) scale(1); } + 0% { + transform: rotate(var(--r, 0deg)) translateY(0px) scale(1); + } + 40% { + transform: rotate(var(--r, 0deg)) translateY(-4px) scale(1.12); + } + 60% { + transform: rotate(var(--r, 0deg)) translateY(-5px) scale(1.14); + } + 100% { + transform: rotate(var(--r, 0deg)) translateY(0px) scale(1); + } } .chevron-svg { @@ -39,7 +47,7 @@ rgba(255, 255, 255, 0) 8.71%, rgba(255, 255, 255, 0.16) 69.69% ), - var(--carrier-right, #806C59); + var(--carrier-right, #806c59); color: white; max-height: 68px; @@ -87,7 +95,7 @@ background-color: color-mix( in srgb, - var(--carrier-right, #806C59) 80%, + var(--carrier-right, #806c59) 80%, black ); } @@ -220,7 +228,7 @@ rgba(255, 255, 255, 0) 8.71%, rgba(255, 255, 255, 0.16) 69.69% ), - var(--carrier-right, #806C59); + var(--carrier-right, #806c59); max-height: calc(100vh - 128px); } @@ -340,7 +348,7 @@ background: linear-gradient( to right, transparent 35%, - color-mix(in srgb, var(--carrier-right, #806C59) 80%, black) 50%, + color-mix(in srgb, var(--carrier-right, #806c59) 80%, black) 50%, transparent 65% ); border-radius: 3px; @@ -380,17 +388,26 @@ .sight-frame-menu-fade.left { left: 0; - background: linear-gradient(to right, rgba(var(--carrier-right-menu-rgb, 179, 165, 152), 0.95), transparent); + background: linear-gradient( + to right, + rgba(var(--carrier-right-menu-rgb, 179, 165, 152), 0.95), + transparent + ); border-radius: 0 0 0 10px; } .sight-frame-menu-fade.right { right: 0; - background: linear-gradient(to left, rgba(var(--carrier-right-menu-rgb, 179, 165, 152), 0.95), transparent); + background: linear-gradient( + to left, + rgba(var(--carrier-right-menu-rgb, 179, 165, 152), 0.95), + transparent + ); border-radius: 0 0 10px 0; } .sight-frame-menu { + z-index: 10000; position: relative; padding: 7px 60px; width: 100%; @@ -825,7 +842,7 @@ border-radius: 32px; right: 20px; bottom: 20px; - background: var(--carrier-right, #806C59); + background: var(--carrier-right, #806c59); z-index: 9999; display: flex; } diff --git a/src/client/src/styles/SideMenu.css b/src/client/src/styles/SideMenu.css index 4d64958..7c97e18 100644 --- a/src/client/src/styles/SideMenu.css +++ b/src/client/src/styles/SideMenu.css @@ -35,6 +35,8 @@ font-size: 16px; margin-top: 120px; font-weight: 500; + width: 220px; + text-align: center; } .side-menu-buttons { @@ -227,12 +229,10 @@ .side-menu-sights-block { flex: 1; min-height: 0; - margin-left: 20px; margin-top: 8px; touch-action: none; overscroll-behavior: contain; - width: auto; - max-width: calc(100% - 20px); + width: 100%; box-sizing: border-box; overflow-x: hidden; overflow-y: auto; @@ -240,7 +240,6 @@ .side-menu-sight { padding-bottom: 2px; - margin-right: 20px; margin-bottom: 6px; margin-top: 6px; border-bottom: 1px solid @@ -254,6 +253,12 @@ position: relative; } +.side-menu-sight-selected-wrapper { + background: rgba(0, 0, 0, 0.2); + margin-left: -20px; + padding-left: 20px; +} + .side-menu-sight > span { display: inline-block; white-space: nowrap; diff --git a/src/client/src/styles/TouchableLayout.css b/src/client/src/styles/TouchableLayout.css index 64c88d8..623c0c7 100644 --- a/src/client/src/styles/TouchableLayout.css +++ b/src/client/src/styles/TouchableLayout.css @@ -43,6 +43,7 @@ position: relative; background: rgba(255, 255, 255, 0.2); border-radius: 3px; + transition: opacity 0.2s ease; } .custom-scrollbar-thumb { @@ -67,6 +68,7 @@ .side-menu-sights-block .scrollable { height: 100%; + padding-left: 20px; } .list-of-sights-content .scrollable-viewport { diff --git a/src/pages/Article/ArticleListPage/index.tsx b/src/pages/Article/ArticleListPage/index.tsx index acb577a..6c23c19 100644 --- a/src/pages/Article/ArticleListPage/index.tsx +++ b/src/pages/Article/ArticleListPage/index.tsx @@ -108,7 +108,7 @@ export const ArticleListPage = observer(() => {
)} - {rows.length > 0 && ( + {(rows.length > 0 || searchQuery) && ( )} diff --git a/src/pages/Carrier/CarrierListPage/index.tsx b/src/pages/Carrier/CarrierListPage/index.tsx index 66bdec5..acad983 100644 --- a/src/pages/Carrier/CarrierListPage/index.tsx +++ b/src/pages/Carrier/CarrierListPage/index.tsx @@ -162,7 +162,7 @@ export const CarrierListPage = observer(() => {
)} - {rows.length > 0 && ( + {(rows.length > 0 || searchQuery) && ( )} diff --git a/src/pages/City/CityListPage/index.tsx b/src/pages/City/CityListPage/index.tsx index 6710407..f14ebf4 100644 --- a/src/pages/City/CityListPage/index.tsx +++ b/src/pages/City/CityListPage/index.tsx @@ -159,7 +159,7 @@ export const CityListPage = observer(() => {
)} - {rows.length > 0 && ( + {(rows.length > 0 || searchQuery) && ( )} diff --git a/src/pages/Country/CountryListPage/index.tsx b/src/pages/Country/CountryListPage/index.tsx index a64e7ae..e3bd7d2 100644 --- a/src/pages/Country/CountryListPage/index.tsx +++ b/src/pages/Country/CountryListPage/index.tsx @@ -111,7 +111,7 @@ export const CountryListPage = observer(() => {
)} - {rows.length > 0 && ( + {(rows.length > 0 || searchQuery) && ( )} diff --git a/src/pages/Media/MediaListPage/index.tsx b/src/pages/Media/MediaListPage/index.tsx index 3ab62e9..72536fa 100644 --- a/src/pages/Media/MediaListPage/index.tsx +++ b/src/pages/Media/MediaListPage/index.tsx @@ -113,7 +113,7 @@ export const MediaListPage = observer(() => { return ( <>
- {rows.length > 0 && ( + {(rows.length > 0 || searchQuery) && ( )} diff --git a/src/pages/Route/RouteCreatePage/index.tsx b/src/pages/Route/RouteCreatePage/index.tsx index 5f99872..ae2c4f2 100644 --- a/src/pages/Route/RouteCreatePage/index.tsx +++ b/src/pages/Route/RouteCreatePage/index.tsx @@ -50,6 +50,7 @@ export const RouteCreatePage = observer(() => { const [routeCoords, setRouteCoords] = useState(""); const [govRouteNumber, setGovRouteNumber] = useState(""); const [governorAppeal, setGovernorAppeal] = useState(""); + const [buttonText, setButtonText] = useState(""); const [direction, setDirection] = useState("backward"); const [scaleMin, setScaleMin] = useState("10"); const [scaleMax, setScaleMax] = useState("100"); @@ -292,6 +293,10 @@ export const RouteCreatePage = observer(() => { newRoute.governor_appeal = governor_appeal; } + if (buttonText.trim()) { + newRoute.button_text = buttonText.trim(); + } + const newId = await routeStore.createRoute(newRoute); toast.success("Маршрут успешно создан"); navigate(`/route/${newId}/edit`); @@ -407,6 +412,18 @@ export const RouteCreatePage = observer(() => { onChange={(e) => setGovRouteNumber(e.target.value)} /> + + Текст кнопки обращения + + setButtonText(e.target.value)} + placeholder="Обращение губернатора" + fullWidth + size="small" + helperText="Если пусто, будет использован текст по умолчанию" + /> + Обращение к пассажирам diff --git a/src/pages/Route/RouteEditPage/index.tsx b/src/pages/Route/RouteEditPage/index.tsx index 1c332ec..9043765 100644 --- a/src/pages/Route/RouteEditPage/index.tsx +++ b/src/pages/Route/RouteEditPage/index.tsx @@ -566,6 +566,22 @@ export const RouteEditPage = observer(() => { }} /> + + Текст кнопки обращения + + + routeStore.setEditRouteData({ + button_text: e.target.value, + }) + } + placeholder="Обращение губернатора" + fullWidth + size="small" + helperText="Если пусто, будет использован текст по умолчанию" + /> + Обращение к пассажирам diff --git a/src/pages/Route/RouteListPage/index.tsx b/src/pages/Route/RouteListPage/index.tsx index a6b7dd8..11184fa 100644 --- a/src/pages/Route/RouteListPage/index.tsx +++ b/src/pages/Route/RouteListPage/index.tsx @@ -270,7 +270,7 @@ export const RouteListPage = observer(() => {
)} - {rows.length > 0 && ( + {(rows.length > 0 || searchQuery) && ( )} diff --git a/src/pages/Route/route-preview/types.ts b/src/pages/Route/route-preview/types.ts index 6710653..8633b8f 100644 --- a/src/pages/Route/route-preview/types.ts +++ b/src/pages/Route/route-preview/types.ts @@ -6,6 +6,7 @@ export interface RouteData { icon_size?: number; font_size: number; governor_appeal: number; + button_text?: string; id: number; path: [number, number][]; rotate: number; diff --git a/src/pages/Sight/SightListPage/index.tsx b/src/pages/Sight/SightListPage/index.tsx index 5416d01..1e16889 100644 --- a/src/pages/Sight/SightListPage/index.tsx +++ b/src/pages/Sight/SightListPage/index.tsx @@ -181,7 +181,7 @@ export const SightListPage = observer(() => { )} - {rows.length > 0 && ( + {(rows.length > 0 || searchQuery) && ( )} diff --git a/src/pages/Snapshot/SnapshotListPage/index.tsx b/src/pages/Snapshot/SnapshotListPage/index.tsx index 5216563..fa151da 100644 --- a/src/pages/Snapshot/SnapshotListPage/index.tsx +++ b/src/pages/Snapshot/SnapshotListPage/index.tsx @@ -316,7 +316,7 @@ export const SnapshotListPage = observer(() => { )} - {rows.length > 0 && ( + {(rows.length > 0 || searchQuery) && ( )} diff --git a/src/pages/Station/StationListPage/index.tsx b/src/pages/Station/StationListPage/index.tsx index f2015f3..475dc17 100644 --- a/src/pages/Station/StationListPage/index.tsx +++ b/src/pages/Station/StationListPage/index.tsx @@ -225,7 +225,7 @@ export const StationListPage = observer(() => { )} - {rows.length > 0 && ( + {(rows.length > 0 || searchQuery) && ( )} diff --git a/src/pages/User/UserListPage/index.tsx b/src/pages/User/UserListPage/index.tsx index 11f7a44..97c46ef 100644 --- a/src/pages/User/UserListPage/index.tsx +++ b/src/pages/User/UserListPage/index.tsx @@ -147,7 +147,7 @@ export const UserListPage = observer(() => { )} - {rows.length > 0 && ( + {(rows.length > 0 || searchQuery) && ( )} diff --git a/src/pages/Vehicle/VehicleListPage/index.tsx b/src/pages/Vehicle/VehicleListPage/index.tsx index 76cff17..c715ffe 100644 --- a/src/pages/Vehicle/VehicleListPage/index.tsx +++ b/src/pages/Vehicle/VehicleListPage/index.tsx @@ -173,7 +173,7 @@ export const VehicleListPage = observer(() => { /> - {rows.length > 0 && ( + {(rows.length > 0 || searchQuery) && ( )} diff --git a/src/shared/store/RouteStore/index.ts b/src/shared/store/RouteStore/index.ts index 9061b44..edb2bbb 100644 --- a/src/shared/store/RouteStore/index.ts +++ b/src/shared/store/RouteStore/index.ts @@ -13,6 +13,7 @@ export type Route = { center_latitude: number; center_longitude: number; governor_appeal: number; + button_text?: string; id: number; icon: string; path: number[][]; @@ -143,6 +144,7 @@ class RouteStore { center_latitude: "", center_longitude: "", governor_appeal: 0, + button_text: "" as string | undefined, id: 0, icon: "", path: [] as number[][],