diff --git a/src/components/FeedModal.tsx b/src/components/FeedModal.tsx index 8ffdb22..5990e15 100644 --- a/src/components/FeedModal.tsx +++ b/src/components/FeedModal.tsx @@ -940,9 +940,7 @@ const FeedModal: React.FC = ({ isOpen, onClose, section, isAdmin cursor: isDeleting ? 'default' : 'pointer', }} > - {isDeleting - ? '...' - : (t('feedAdminDeleteNo') ? (t('feedAdminDeleteYes') || 'Да, удалить') : 'Да, удалить')} + {isDeleting ? '...' : (t('feedAdminDeleteYes') || 'Да, удалить')} diff --git a/src/pages/MenuPage.tsx b/src/pages/MenuPage.tsx index 322d25e..f81a093 100644 --- a/src/pages/MenuPage.tsx +++ b/src/pages/MenuPage.tsx @@ -85,30 +85,48 @@ const MenuPage: React.FC = () => { return labels[language] || labels.en; }; - const makeButtonHandlers = useCallback((buttonName: string, action: () => void) => ({ - onTouchStart: (e: React.TouchEvent) => { - touchStartY.current = e.touches[0].clientY; - touchStartX.current = e.touches[0].clientX; - touchMoved.current = false; - setPressing(buttonName); - }, - onTouchMove: (e: React.TouchEvent) => { - const deltaY = Math.abs(e.touches[0].clientY - touchStartY.current); - const deltaX = Math.abs(e.touches[0].clientX - touchStartX.current); - if (deltaY > SCROLL_THRESHOLD || deltaX > SCROLL_THRESHOLD) { - touchMoved.current = true; + // 🔧 ФИКС (22.09.2026): на мобильных (TG WebView) тап вызывал action дважды — + // сначала onTouchEnd, потом синтетический onMouseUp. Открывались 2 модалки. + // Решение: убираем action() из onMouseUp — оставляем только визуальный сброс. + // На десктопе (без touch) работает onMouseUp → action. + const makeButtonHandlers = useCallback((buttonName: string, action: () => void) => { + let touchHandled = false; + + return { + onTouchStart: (e: React.TouchEvent) => { + touchStartY.current = e.touches[0].clientY; + touchStartX.current = e.touches[0].clientX; + touchMoved.current = false; + touchHandled = false; + setPressing(buttonName); + }, + onTouchMove: (e: React.TouchEvent) => { + const deltaY = Math.abs(e.touches[0].clientY - touchStartY.current); + const deltaX = Math.abs(e.touches[0].clientX - touchStartX.current); + if (deltaY > SCROLL_THRESHOLD || deltaX > SCROLL_THRESHOLD) { + touchMoved.current = true; + setPressing(null); + } + }, + onTouchEnd: () => { setPressing(null); - } - }, - onTouchEnd: () => { - setPressing(null); - if (!touchMoved.current) { + if (!touchMoved.current) { + touchHandled = true; + action(); + } + }, + onMouseDown: () => setPressing(buttonName), + onMouseUp: () => { + setPressing(null); + // 🔧 Если touch уже обработал — не вызываем action повторно + if (touchHandled) { + touchHandled = false; + return; + } action(); - } - }, - onMouseDown: () => setPressing(buttonName), - onMouseUp: () => { setPressing(null); action(); }, - }), []); + }, + }; + }, []); useEffect(() => { const myId = getUserId();