fix(teacher): убрана зелёная полоса, скорость flip 0.6, фикс дублирования title (22.09.2026)
This commit is contained in:
@@ -86,8 +86,6 @@ const LessonCard: React.FC<LessonCardProps> = ({
|
||||
...extra,
|
||||
});
|
||||
|
||||
const progressPercent = totalCards > 0 ? ((cardIndex + 1) / totalCards) * 100 : 0;
|
||||
|
||||
// ============ Титульная ============
|
||||
const renderIntro = () => (
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: '16px', height: '100%' }}>
|
||||
@@ -430,31 +428,18 @@ const LessonCard: React.FC<LessonCardProps> = ({
|
||||
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)',
|
||||
}),
|
||||
}}>
|
||||
{/* Прогресс-бар */}
|
||||
<div style={{
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
height: '4px',
|
||||
background: 'rgba(0,0,0,0.05)',
|
||||
borderTopLeftRadius: radius.lg,
|
||||
borderTopRightRadius: radius.lg,
|
||||
overflow: 'hidden',
|
||||
}}>
|
||||
<div style={{
|
||||
width: `${progressPercent}%`,
|
||||
height: '100%',
|
||||
background: `linear-gradient(90deg, ${brandColor}, #27AE60)`,
|
||||
transition: 'width 0.4s ease',
|
||||
}} />
|
||||
</div>
|
||||
{/*
|
||||
🔧 ФИКС (22.09.2026): убран прогресс-бар сверху карточки.
|
||||
Он визуально сливался с верхним бордером и выглядел как «зелёная полоса».
|
||||
Оставили только счётчик `1 / N`.
|
||||
*/}
|
||||
|
||||
{/* Счётчик */}
|
||||
<div style={{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState } from 'react';
|
||||
import React, { useState, useEffect, useRef } from 'react';
|
||||
import LessonCard, { type LessonCardData } from './LessonCard';
|
||||
|
||||
interface LessonCardStackProps {
|
||||
@@ -18,10 +18,19 @@ const LessonCardStack: React.FC<LessonCardStackProps> = ({
|
||||
const [selectedAnswer, setSelectedAnswer] = useState<string | null>(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<LessonCardStackProps> = ({
|
||||
setTimeout(() => {
|
||||
setRotation(0);
|
||||
setIsFlipping(false);
|
||||
}, 200);
|
||||
}, 200);
|
||||
}, FLIP_HALF_MS);
|
||||
}, FLIP_HALF_MS);
|
||||
};
|
||||
|
||||
const handleNext = async () => {
|
||||
@@ -51,12 +60,16 @@ const LessonCardStack: React.FC<LessonCardStackProps> = ({
|
||||
}
|
||||
}
|
||||
|
||||
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 = () => {
|
||||
|
||||
@@ -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: [],
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user