🌊 Волна 3: frontend юзабилити топ (4 бага)
- HINT_AUTO_SELECTS_CORRECT: подсказка не засчитывается как ответ (PracticeViewPage.tsx, паттерн из LessonViewPage) - ALERT_IN_TELEGRAM_MINIAPP: alert() → кастомный toast (TeacherChatPage.tsx, 3 места) - BUBBLE_ERROR_MESSAGE_STUCK: errorTimeoutRef + автоскрытие (BubbleWordsPage.tsx) - WORDSEARCH_STREAK_ON_ALREADY_FOUND: инкремент внутри проверки includes (WordSearchPage.tsx) Аудит: Issue #3, frontend 4/34 задач
This commit is contained in:
@@ -43,6 +43,9 @@ const BubbleWordsPage: React.FC = () => {
|
||||
const isMountedRef = useRef(true);
|
||||
const messageTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
const hintTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
// 🔧 ФИКС (23.09.2026): BUBBLE_ERROR_MESSAGE_STUCK — добавлен таймер для errorMessage,
|
||||
// чтобы плашка автоскрывалась (раньше висела бесконечно).
|
||||
const errorTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
const startTimeRef = useRef<number>(0);
|
||||
const rulesShownRef = useRef(false);
|
||||
|
||||
@@ -84,6 +87,8 @@ const BubbleWordsPage: React.FC = () => {
|
||||
isMountedRef.current = false;
|
||||
if (messageTimeoutRef.current) clearTimeout(messageTimeoutRef.current);
|
||||
if (hintTimeoutRef.current) clearTimeout(hintTimeoutRef.current);
|
||||
// 🔧 ФИКС (23.09.2026): BUBBLE_ERROR_MESSAGE_STUCK — cleanup нового таймера
|
||||
if (errorTimeoutRef.current) clearTimeout(errorTimeoutRef.current);
|
||||
};
|
||||
}, []);
|
||||
|
||||
@@ -150,6 +155,17 @@ const BubbleWordsPage: React.FC = () => {
|
||||
}, 1500);
|
||||
};
|
||||
|
||||
// 🔧 ФИКС (23.09.2026): BUBBLE_ERROR_MESSAGE_STUCK — helper для errorMessage
|
||||
// с автоскрытием через 2 секунды (по аналогии с showMessage).
|
||||
const showError = (msg: string) => {
|
||||
if (!isMountedRef.current) return;
|
||||
setErrorMessage(msg);
|
||||
if (errorTimeoutRef.current) clearTimeout(errorTimeoutRef.current);
|
||||
errorTimeoutRef.current = setTimeout(() => {
|
||||
if (isMountedRef.current) setErrorMessage(null);
|
||||
}, 2000);
|
||||
};
|
||||
|
||||
const handleBubbleClick = useCallback((bubble: Bubble) => {
|
||||
if (completed || isTransitioning) return;
|
||||
if (foundWords.includes(bubble.word_pl)) return;
|
||||
@@ -231,7 +247,8 @@ const BubbleWordsPage: React.FC = () => {
|
||||
|
||||
const handleFirstLetterHint = () => {
|
||||
if (firstLetterHintsUsed >= maxFirstLetterHints) {
|
||||
setErrorMessage('⚠️ ' + (t('noMoreFirstLetterHints') || 'No more hints'));
|
||||
// 🔧 ФИКС (23.09.2026): BUBBLE_ERROR_MESSAGE_STUCK — используем showError
|
||||
showError('⚠️ ' + (t('noMoreFirstLetterHints') || 'No more hints'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user