fix(teacher): убрана зелёная полоса, скорость flip 0.6, фикс дублирования title (22.09.2026)
This commit is contained in:
@@ -86,8 +86,6 @@ const LessonCard: React.FC<LessonCardProps> = ({
|
|||||||
...extra,
|
...extra,
|
||||||
});
|
});
|
||||||
|
|
||||||
const progressPercent = totalCards > 0 ? ((cardIndex + 1) / totalCards) * 100 : 0;
|
|
||||||
|
|
||||||
// ============ Титульная ============
|
// ============ Титульная ============
|
||||||
const renderIntro = () => (
|
const renderIntro = () => (
|
||||||
<div style={{ display: 'flex', flexDirection: 'column', gap: '16px', height: '100%' }}>
|
<div style={{ display: 'flex', flexDirection: 'column', gap: '16px', height: '100%' }}>
|
||||||
@@ -430,31 +428,18 @@ const LessonCard: React.FC<LessonCardProps> = ({
|
|||||||
display: 'flex',
|
display: 'flex',
|
||||||
flexDirection: 'column',
|
flexDirection: 'column',
|
||||||
transform: `rotateY(${rotation}deg)`,
|
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',
|
transformStyle: 'preserve-3d',
|
||||||
backfaceVisibility: 'hidden',
|
backfaceVisibility: 'hidden',
|
||||||
boxShadow: '0 24px 60px rgba(31,38,73,0.20), inset 0 1px 0 rgba(255,255,255,0.85)',
|
boxShadow: '0 24px 60px rgba(31,38,73,0.20), inset 0 1px 0 rgba(255,255,255,0.85)',
|
||||||
}),
|
}),
|
||||||
}}>
|
}}>
|
||||||
{/* Прогресс-бар */}
|
{/*
|
||||||
<div style={{
|
🔧 ФИКС (22.09.2026): убран прогресс-бар сверху карточки.
|
||||||
position: 'absolute',
|
Он визуально сливался с верхним бордером и выглядел как «зелёная полоса».
|
||||||
top: 0,
|
Оставили только счётчик `1 / N`.
|
||||||
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>
|
|
||||||
|
|
||||||
{/* Счётчик */}
|
{/* Счётчик */}
|
||||||
<div style={{
|
<div style={{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState, useEffect, useRef } from 'react';
|
||||||
import LessonCard, { type LessonCardData } from './LessonCard';
|
import LessonCard, { type LessonCardData } from './LessonCard';
|
||||||
|
|
||||||
interface LessonCardStackProps {
|
interface LessonCardStackProps {
|
||||||
@@ -18,10 +18,19 @@ const LessonCardStack: React.FC<LessonCardStackProps> = ({
|
|||||||
const [selectedAnswer, setSelectedAnswer] = useState<string | null>(null);
|
const [selectedAnswer, setSelectedAnswer] = useState<string | null>(null);
|
||||||
const [textInput, setTextInput] = useState('');
|
const [textInput, setTextInput] = useState('');
|
||||||
const [hintUsed, setHintUsed] = useState(false);
|
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 currentCard = cards[currentIndex];
|
||||||
const totalCards = cards.length;
|
const totalCards = cards.length;
|
||||||
|
|
||||||
|
// 🔧 ФИКС (22.09.2026): скорость flip 0.4 → 0.6 (по просьбе).
|
||||||
|
const FLIP_HALF_MS = 300; // половина от 0.6 сек
|
||||||
|
|
||||||
const flip = (nextIndex: number) => {
|
const flip = (nextIndex: number) => {
|
||||||
if (isFlipping) return;
|
if (isFlipping) return;
|
||||||
|
|
||||||
@@ -39,8 +48,8 @@ const LessonCardStack: React.FC<LessonCardStackProps> = ({
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setRotation(0);
|
setRotation(0);
|
||||||
setIsFlipping(false);
|
setIsFlipping(false);
|
||||||
}, 200);
|
}, FLIP_HALF_MS);
|
||||||
}, 200);
|
}, FLIP_HALF_MS);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleNext = async () => {
|
const handleNext = async () => {
|
||||||
@@ -51,12 +60,16 @@ const LessonCardStack: React.FC<LessonCardStackProps> = ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentIndex >= totalCards - 1) {
|
// 🔧 ФИКС (22.09.2026): ждём, пока родитель обновит cards.
|
||||||
onComplete();
|
// Используем cardsRef — видим АКТУАЛЬНОЕ количество.
|
||||||
return;
|
setTimeout(() => {
|
||||||
}
|
const actualTotal = cardsRef.current.length;
|
||||||
|
if (currentIndex + 1 < actualTotal) {
|
||||||
flip(currentIndex + 1);
|
flip(currentIndex + 1);
|
||||||
|
} else {
|
||||||
|
onComplete();
|
||||||
|
}
|
||||||
|
}, 200);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleStartLesson = () => {
|
const handleStartLesson = () => {
|
||||||
|
|||||||
@@ -400,14 +400,18 @@ const TeacherChatPage: React.FC = () => {
|
|||||||
if (data.question) {
|
if (data.question) {
|
||||||
const cards: LessonCardData[] = [];
|
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({
|
cards.push({
|
||||||
type: 'intro',
|
type: 'intro',
|
||||||
levelCode: 'A1', // TODO: подтянуть из data
|
levelCode: 'A1',
|
||||||
topicName: data.topic_name || '',
|
topicName: data.topic_name || '',
|
||||||
lessonNumber: 1, // TODO: подтянуть из data
|
lessonNumber: 1,
|
||||||
lessonTitle: data.text.split('\n')[0] || '',
|
lessonTitle,
|
||||||
explanation: data.text, // временно весь text
|
explanation: explanationRest,
|
||||||
examples: [],
|
examples: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user