🌊 Волна 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:
2026-09-23 15:14:28 +03:00
parent b88b9b21de
commit f7389afa4f
4 changed files with 74 additions and 16 deletions
+39 -3
View File
@@ -97,6 +97,8 @@ const TeacherChatPage: React.FC = () => {
const [examplesError, setExamplesError] = useState<string | null>(null);
const [isStartingPractice, setIsStartingPractice] = useState(false);
const [playingExampleLine, setPlayingExampleLine] = useState<number | null>(null);
// 🔧 ФИКС (23.09.2026): ALERT_IN_TELEGRAM_MINIAPP — заменяем alert() на кастомный toast
const [toastMessage, setToastMessage] = useState<string | null>(null);
const messagesEndRef = useRef<HTMLDivElement>(null);
const inputRef = useRef<HTMLInputElement>(null);
@@ -124,6 +126,14 @@ const TeacherChatPage: React.FC = () => {
return text.includes('🇵🇱') || text.includes('→') || /[ąćęłńóśźżĄĆĘŁŃÓŚŹŻ]/.test(text);
};
// 🔧 ФИКС (23.09.2026): ALERT_IN_TELEGRAM_MINIAPP — helper для toast вместо alert()
const showToast = (msg: string) => {
setToastMessage(msg);
setTimeout(() => {
setToastMessage(null);
}, 2500);
};
const isFreeQuestion = (text: string): boolean => {
const trimmed = text.trim();
if (trimmed.endsWith('?')) return true;
@@ -661,7 +671,8 @@ const TeacherChatPage: React.FC = () => {
try {
const analytics = await getLearningAnalytics();
if (!analytics.has_practice_available) {
alert(t('testPracticeNoWeak'));
// 🔧 ФИКС (23.09.2026): ALERT_IN_TELEGRAM_MINIAPP — toast вместо alert()
showToast(t('testPracticeNoWeak'));
setIsStartingPractice(false);
return;
}
@@ -676,12 +687,14 @@ const TeacherChatPage: React.FC = () => {
},
});
} else {
alert(data.message || t('testPracticeNoWeak'));
// 🔧 ФИКС (23.09.2026): ALERT_IN_TELEGRAM_MINIAPP — toast вместо alert()
showToast(data.message || t('testPracticeNoWeak'));
setIsStartingPractice(false);
}
} catch (e) {
console.error('Error starting practice:', e);
alert(t('teacherAIError'));
// 🔧 ФИКС (23.09.2026): ALERT_IN_TELEGRAM_MINIAPP — toast вместо alert()
showToast(t('teacherAIError'));
setIsStartingPractice(false);
}
};
@@ -746,6 +759,29 @@ const TeacherChatPage: React.FC = () => {
<div style={{ position: 'fixed', top: '-80px', right: '-60px', width: '260px', height: '260px', borderRadius: '50%', background: teacherColor, opacity: 0.18, filter: 'blur(90px)', pointerEvents: 'none', zIndex: 0 }} />
<div style={{ position: 'fixed', bottom: '-50px', left: '-40px', width: '240px', height: '240px', borderRadius: '50%', background: brandColor, opacity: 0.14, filter: 'blur(80px)', pointerEvents: 'none', zIndex: 0 }} />
{/* 🔧 ФИКС (23.09.2026): ALERT_IN_TELEGRAM_MINIAPP — кастомный toast вместо alert() */}
{toastMessage && (
<div style={{
position: 'fixed',
top: '20px',
left: '50%',
transform: 'translateX(-50%)',
zIndex: 999,
padding: '12px 20px',
background: 'rgba(26,26,46,0.95)',
color: '#FFFFFF',
fontSize: '14px',
fontWeight: 600,
borderRadius: radius.md,
boxShadow: '0 8px 24px rgba(0,0,0,0.25)',
maxWidth: '90vw',
textAlign: 'center',
animation: 'modalFadeIn 0.25s ease',
}}>
{toastMessage}
</div>
)}
<style>{`
@keyframes fadeInUp {
0% { transform: translateY(10px); opacity: 0; }