From 1d146448237e4852ebbe31d1159b4df8aa80040b Mon Sep 17 00:00:00 2001 From: Drobysh Date: Tue, 22 Sep 2026 15:03:00 +0300 Subject: [PATCH] =?UTF-8?q?fix(teacher):=20=D1=83=D0=B1=D1=80=D0=B0=D0=BD?= =?UTF-8?q?=D0=B0=20=D0=B7=D0=B5=D0=BB=D1=91=D0=BD=D0=B0=D1=8F=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=BB=D0=BE=D1=81=D0=B0,=20=D1=81=D0=BA=D0=BE=D1=80?= =?UTF-8?q?=D0=BE=D1=81=D1=82=D1=8C=20flip=200.6,=20=D1=84=D0=B8=D0=BA?= =?UTF-8?q?=D1=81=20=D0=B4=D1=83=D0=B1=D0=BB=D0=B8=D1=80=D0=BE=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20title=20(22.09.2026)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/LessonCard.tsx | 29 +++++++--------------------- src/components/LessonCardStack.tsx | 31 +++++++++++++++++++++--------- src/pages/TeacherChatPage.tsx | 14 +++++++++----- 3 files changed, 38 insertions(+), 36 deletions(-) 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: [], });