🌊 Волна 19: frontend — 7 фиксов
App.tsx: - DASHBOARD_CLICK_LOST_BEFORE_ADMIN_LOAD: флаг isAdminResolved - RETRY_TIMER_LEAK_ON_UNMOUNT: isMountedRef перед retry BubbleWordsPage.tsx: - BUBBLE_SHOWWORDS_HINT_COUNT: флаг showWordsHintUsedRef — 1 раз за уровень LessonViewPage.tsx: - LESSON_NEXT_NO_RESULTS: экран результатов (правильных/всего/процент) api.ts: - ABORT_ERROR_NOT_USER_FRIENDLY: понятное сообщение при таймауте - DELETE_FEED_NO_INIT_DATA_CHECK: проверка initData - DEAD_EXPORT_GET_IS_ADMIN: удалён мёртвый экспорт Аудит v6: frontend 7/7 закрыто
This commit is contained in:
@@ -67,6 +67,10 @@ const LessonViewPage: React.FC = () => {
|
||||
const [hintUsed, setHintUsed] = useState<Record<string, boolean>>({});
|
||||
const [showHint, setShowHint] = useState(false);
|
||||
const startTimeRef = useRef<number>(Date.now());
|
||||
// 🔧 ФИКС (25.09.2026): LESSON_NEXT_NO_RESULTS —
|
||||
// экран результатов после последнего вопроса.
|
||||
const [showResults, setShowResults] = useState(false);
|
||||
const [sessionStats, setSessionStats] = useState<{ total: number; correct: number } | null>(null);
|
||||
|
||||
const brandColor = '#2ECC71';
|
||||
const textColor = '#1A1A2E';
|
||||
@@ -156,14 +160,39 @@ const LessonViewPage: React.FC = () => {
|
||||
startTimeRef.current = Date.now();
|
||||
} else {
|
||||
setIsCompleting(true);
|
||||
|
||||
// 🔧 ФИКС (25.09.2026): LESSON_NEXT_NO_RESULTS —
|
||||
// считаем результаты ДО навигации и показываем экран.
|
||||
const questions = lesson?.questions || [];
|
||||
let correct = 0;
|
||||
for (const q of questions) {
|
||||
const selected = selectedAnswers[q.question.question_id];
|
||||
const correctOpt = q.options.find(o => o.is_correct);
|
||||
if (selected && correctOpt && selected === correctOpt.option_key) {
|
||||
correct++;
|
||||
}
|
||||
}
|
||||
setSessionStats({ total: questions.length, correct });
|
||||
|
||||
let completionData: any = null;
|
||||
if (sessionId) {
|
||||
try {
|
||||
await completeLearningSession(sessionId);
|
||||
completionData = await completeLearningSession(sessionId);
|
||||
} catch (e) {
|
||||
console.error('Error completing session:', e);
|
||||
}
|
||||
}
|
||||
navigate(`/lessons/topic/${topicId}`);
|
||||
|
||||
// Если сервер вернул свои цифры — используем их
|
||||
if (completionData?.total !== undefined) {
|
||||
setSessionStats({
|
||||
total: completionData.total,
|
||||
correct: completionData.correct_count ?? completionData.correct ?? correct,
|
||||
});
|
||||
}
|
||||
|
||||
setShowResults(true);
|
||||
setIsCompleting(false);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -176,6 +205,101 @@ const LessonViewPage: React.FC = () => {
|
||||
}
|
||||
};
|
||||
|
||||
// 🔧 ФИКС (25.09.2026): LESSON_NEXT_NO_RESULTS — экран результатов.
|
||||
if (showResults && sessionStats) {
|
||||
const percent = sessionStats.total > 0
|
||||
? Math.round((sessionStats.correct / sessionStats.total) * 100)
|
||||
: 0;
|
||||
const isGood = percent >= 70;
|
||||
|
||||
return (
|
||||
<div style={{
|
||||
minHeight: '100vh',
|
||||
background: bgColor,
|
||||
color: textColor,
|
||||
fontFamily: fonts.main,
|
||||
padding: '24px',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
position: 'relative',
|
||||
overflow: 'hidden',
|
||||
}}>
|
||||
<div style={{ position: 'fixed', top: '-80px', right: '-60px', width: '260px', height: '260px', borderRadius: '50%', background: brandColor, opacity: 0.18, filter: 'blur(90px)', pointerEvents: 'none', zIndex: 0 }} />
|
||||
|
||||
<div style={{
|
||||
...glass({ padding: '32px 24px', borderRadius: radius.lg, maxWidth: '400px', width: '100%' }),
|
||||
position: 'relative',
|
||||
zIndex: 1,
|
||||
textAlign: 'center',
|
||||
animation: 'fadeInUp 0.3s ease',
|
||||
}}>
|
||||
<div style={{ fontSize: '56px', marginBottom: '12px' }}>
|
||||
{isGood ? '🎉' : '💪'}
|
||||
</div>
|
||||
<h2 style={{ fontSize: '22px', fontWeight: 800, color: textColor, margin: '0 0 20px 0' }}>
|
||||
{t('teacherCompleted') || 'Lekcja ukończona!'}
|
||||
</h2>
|
||||
|
||||
<div style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
gap: '24px',
|
||||
marginBottom: '24px',
|
||||
}}>
|
||||
<div>
|
||||
<div style={{ fontSize: '32px', fontWeight: 800, color: brandColor }}>
|
||||
{sessionStats.correct}
|
||||
</div>
|
||||
<div style={{ fontSize: '12px', color: subColor, textTransform: 'uppercase', letterSpacing: '1px' }}>
|
||||
{t('testCorrectAnswers') || 'poprawnych'}
|
||||
</div>
|
||||
</div>
|
||||
<div style={{ width: '1px', background: 'rgba(0,0,0,0.1)' }} />
|
||||
<div>
|
||||
<div style={{ fontSize: '32px', fontWeight: 800, color: textColor }}>
|
||||
{sessionStats.total}
|
||||
</div>
|
||||
<div style={{ fontSize: '12px', color: subColor, textTransform: 'uppercase', letterSpacing: '1px' }}>
|
||||
{t('testQuestion') || 'pytań'}
|
||||
</div>
|
||||
</div>
|
||||
<div style={{ width: '1px', background: 'rgba(0,0,0,0.1)' }} />
|
||||
<div>
|
||||
<div style={{ fontSize: '32px', fontWeight: 800, color: isGood ? brandColor : '#F39C12' }}>
|
||||
{percent}%
|
||||
</div>
|
||||
<div style={{ fontSize: '12px', color: subColor, textTransform: 'uppercase', letterSpacing: '1px' }}>
|
||||
%
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button
|
||||
onClick={() => navigate(`/lessons/topic/${topicId}`)}
|
||||
style={{
|
||||
width: '100%',
|
||||
padding: '16px',
|
||||
borderRadius: radius.md,
|
||||
border: 'none',
|
||||
background: `linear-gradient(135deg, ${brandColor}, #27AE60)`,
|
||||
color: '#FFFFFF',
|
||||
fontSize: '16px',
|
||||
fontWeight: 700,
|
||||
cursor: 'pointer',
|
||||
boxShadow: `0 4px 15px ${brandColor}40`,
|
||||
}}
|
||||
onTouchStart={(e) => { e.currentTarget.style.transform = 'scale(0.97)'; }}
|
||||
onTouchEnd={(e) => { e.currentTarget.style.transform = 'scale(1)'; }}
|
||||
>
|
||||
{t('testBackToTopic') || 'Powrót do tematu'}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
<div style={{
|
||||
|
||||
Reference in New Issue
Block a user