diff --git a/src/components/LessonCard.tsx b/src/components/LessonCard.tsx index e156670..3c2fc67 100644 --- a/src/components/LessonCard.tsx +++ b/src/components/LessonCard.tsx @@ -86,8 +86,6 @@ const LessonCard: React.FC = ({ ...extra, }); - const progressPercent = totalCards > 0 ? ((cardIndex + 1) / totalCards) * 100 : 0; - // ============ Титульная ============ const renderIntro = () => (
@@ -430,31 +428,18 @@ const LessonCard: React.FC = ({ display: 'flex', flexDirection: 'column', transform: `rotateY(${rotation}deg)`, - transition: isFlipping ? 'transform 0.2s ease-in-out' : 'none', + // 🔧 ФИКС (22.09.2026): скорость flip 0.4 → 0.6 (0.3 на пол-оборота). + transition: isFlipping ? 'transform 0.3s ease-in-out' : 'none', transformStyle: 'preserve-3d', backfaceVisibility: 'hidden', boxShadow: '0 24px 60px rgba(31,38,73,0.20), inset 0 1px 0 rgba(255,255,255,0.85)', }), }}> - {/* Прогресс-бар */} -
-
-
+ {/* + 🔧 ФИКС (22.09.2026): убран прогресс-бар сверху карточки. + Он визуально сливался с верхним бордером и выглядел как «зелёная полоса». + Оставили только счётчик `1 / N`. + */} {/* Счётчик */}
= ({ const [selectedAnswer, setSelectedAnswer] = useState(null); const [textInput, setTextInput] = useState(''); const [hintUsed, setHintUsed] = useState(false); + const cardsRef = useRef(cards); + + // 🔧 ФИКС (22.09.2026): cardsRef — актуальный массив cards для setTimeout. + useEffect(() => { + cardsRef.current = cards; + }, [cards]); const currentCard = cards[currentIndex]; const totalCards = cards.length; + // 🔧 ФИКС (22.09.2026): скорость flip 0.4 → 0.6 (по просьбе). + const FLIP_HALF_MS = 300; // половина от 0.6 сек + const flip = (nextIndex: number) => { if (isFlipping) return; @@ -39,8 +48,8 @@ const LessonCardStack: React.FC = ({ setTimeout(() => { setRotation(0); setIsFlipping(false); - }, 200); - }, 200); + }, FLIP_HALF_MS); + }, FLIP_HALF_MS); }; const handleNext = async () => { @@ -51,12 +60,16 @@ const LessonCardStack: React.FC = ({ } } - if (currentIndex >= totalCards - 1) { - onComplete(); - return; - } - - flip(currentIndex + 1); + // 🔧 ФИКС (22.09.2026): ждём, пока родитель обновит cards. + // Используем cardsRef — видим АКТУАЛЬНОЕ количество. + setTimeout(() => { + const actualTotal = cardsRef.current.length; + if (currentIndex + 1 < actualTotal) { + flip(currentIndex + 1); + } else { + onComplete(); + } + }, 200); }; const handleStartLesson = () => { diff --git a/src/pages/TeacherChatPage.tsx b/src/pages/TeacherChatPage.tsx index 4137d33..ae84c25 100644 --- a/src/pages/TeacherChatPage.tsx +++ b/src/pages/TeacherChatPage.tsx @@ -400,14 +400,18 @@ const TeacherChatPage: React.FC = () => { if (data.question) { const cards: LessonCardData[] = []; - // 1. Титульная + // 🔧 ФИКС (22.09.2026): убираем title из explanation, чтобы не дублировался. + const textLines = data.text.split('\n'); + const lessonTitle = textLines[0] || ''; + const explanationRest = textLines.slice(1).join('\n').trim(); + cards.push({ type: 'intro', - levelCode: 'A1', // TODO: подтянуть из data + levelCode: 'A1', topicName: data.topic_name || '', - lessonNumber: 1, // TODO: подтянуть из data - lessonTitle: data.text.split('\n')[0] || '', - explanation: data.text, // временно весь text + lessonNumber: 1, + lessonTitle, + explanation: explanationRest, examples: [], });