fix(frontend): опечатка в DeleteYes, двойной tap в MenuPage (22.09.2026)

This commit is contained in:
2026-09-22 12:50:44 +03:00
parent 881c8b99d6
commit eabe823d7f
2 changed files with 41 additions and 25 deletions
+1 -3
View File
@@ -940,9 +940,7 @@ const FeedModal: React.FC<FeedModalProps> = ({ isOpen, onClose, section, isAdmin
cursor: isDeleting ? 'default' : 'pointer',
}}
>
{isDeleting
? '...'
: (t('feedAdminDeleteNo') ? (t('feedAdminDeleteYes') || 'Да, удалить') : 'Да, удалить')}
{isDeleting ? '...' : (t('feedAdminDeleteYes') || 'Да, удалить')}
</button>
</div>
</div>
+40 -22
View File
@@ -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();