fix(frontend): опечатка в DeleteYes, двойной tap в MenuPage (22.09.2026)
This commit is contained in:
+40
-22
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user