From 4497c5895e99b8542211caf845b0b6941ebf5e1d Mon Sep 17 00:00:00 2001 From: anibilag Date: Mon, 3 Nov 2025 22:20:24 +0300 Subject: [PATCH] =?UTF-8?q?=D0=92=D0=B5=D1=80=D1=81=D0=B8=D1=8F=201.2.8=20?= =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B2?= =?UTF-8?q?=20=D0=BC=D0=BE=D0=B1=D0=B8=D0=BB=D1=8C=D0=BD=D0=BE=D0=BC=20?= =?UTF-8?q?=D0=BC=D0=B5=D0=BD=D1=8E=20-=20=D0=B7=D0=B0=D0=BA=D1=80=D1=8B?= =?UTF-8?q?=D1=82=D0=B8=D0=B5=20=D0=BC=D0=B5=D0=BD=D1=8E=20=D0=BF=D1=80?= =?UTF-8?q?=D0=B8=20=D0=B2=D1=8B=D0=B1=D0=BE=D1=80=D0=B5.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/components/Header/MobileMenu.tsx | 17 +++++++++++++++-- src/components/Header/index.tsx | 8 +++++++- src/pages/ArticlePage.tsx | 5 +++++ 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 68fb8b2..2d05e69 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "vite-react-typescript-starter", "private": true, - "version": "1.2.7", + "version": "1.2.8", "type": "module", "scripts": { "dev": "vite", diff --git a/src/components/Header/MobileMenu.tsx b/src/components/Header/MobileMenu.tsx index 868b635..bf43384 100644 --- a/src/components/Header/MobileMenu.tsx +++ b/src/components/Header/MobileMenu.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useEffect } from 'react'; import { Link } from 'react-router-dom'; import { CityTitles, CategoryTitles } from '../../types'; @@ -9,6 +9,7 @@ interface MobileMenuProps { currentCategory: string | null; currentCity: string | null; onCityChange: (event: React.ChangeEvent) => void; + onClose: () => void; } export function MobileMenu({ @@ -17,8 +18,19 @@ export function MobileMenu({ cities, currentCategory, currentCity, - onCityChange + onCityChange, + onClose }: MobileMenuProps) { + + // Блокируем прокрутку body при открытом меню + useEffect(() => { + if (isOpen) { + document.body.style.overflow = 'hidden'; + } else { + document.body.style.overflow = ''; + } + }, [isOpen]); + if (!isOpen) return null; return ( @@ -47,6 +59,7 @@ export function MobileMenu({ { + setIsMobileMenuOpen(false); + }, [location]); + const handleCityChange = (event: React.ChangeEvent) => { const city = event.target.value; const params = new URLSearchParams(location.search); @@ -116,6 +121,7 @@ export function Header() { currentCategory={currentCategory} currentCity={currentCity} onCityChange={handleCityChange} + onClose={() => setIsMobileMenuOpen(false)} /> ); diff --git a/src/pages/ArticlePage.tsx b/src/pages/ArticlePage.tsx index a811504..d7b0b1e 100644 --- a/src/pages/ArticlePage.tsx +++ b/src/pages/ArticlePage.tsx @@ -46,6 +46,11 @@ export function ArticlePage() { try { const response = await axios.get(`/api/articles/${id}`); setArticleData(response.data); + + // Сообщаем react-snap, что страница готова + //if (window.snapSaveState) { + // window.snapSaveState(); + //} } catch (error) { setError('Не удалось загрузить статью'); console.error(error);