diff --git a/src/pages/PerformanceDomainPracticePage.tsx b/src/pages/PerformanceDomainPracticePage.tsx index d91918a..c088551 100644 --- a/src/pages/PerformanceDomainPracticePage.tsx +++ b/src/pages/PerformanceDomainPracticePage.tsx @@ -1,5 +1,5 @@ -import { useEffect, useMemo, useRef, useState, type ReactNode } from 'react' -import { AnimatePresence, motion } from 'framer-motion' +import { useEffect, useMemo, useState, type ReactNode } from 'react' +import { motion } from 'framer-motion' import { Link } from 'react-router-dom' import clsx from 'clsx' import { @@ -55,8 +55,6 @@ interface CircularProgressProps { } const STORAGE_KEY = 'performance-domain-practice-progress-v2' -const CORRECT_DELAY = 900 -const WRONG_DELAY = 1800 const scopeOptions: Array<{ value: PracticeScope; label: string }> = [ { value: 'all', label: '全部' }, @@ -264,7 +262,6 @@ export default function PerformanceDomainPracticePage() { () => new Map(questionBank.map((question) => [question.id, question])), [questionBank] ) - const autoNextTimerRef = useRef(null) const [progress, setProgress] = useState(() => getStoredProgress(questionBank) @@ -304,23 +301,7 @@ export default function PerformanceDomainPracticePage() { } }, [isFinished]) - useEffect(() => { - return () => { - if (autoNextTimerRef.current) { - window.clearTimeout(autoNextTimerRef.current) - } - } - }, []) - - const clearAutoNextTimer = () => { - if (autoNextTimerRef.current) { - window.clearTimeout(autoNextTimerRef.current) - autoNextTimerRef.current = null - } - } - const restartPractice = (scope = progress.scope) => { - clearAutoNextTimer() setProgress(createProgress(scope, questionBank)) setAnswerState(null) setShowCelebration(false) @@ -334,7 +315,6 @@ export default function PerformanceDomainPracticePage() { const advanceToNext = (isCorrect: boolean) => { if (!currentQuestionId) return - clearAutoNextTimer() setAnswerState(null) setProgress((prev) => { @@ -359,19 +339,6 @@ export default function PerformanceDomainPracticePage() { }) } - useEffect(() => { - if (!answerState) return - - clearAutoNextTimer() - autoNextTimerRef.current = window.setTimeout(() => { - advanceToNext(answerState.isCorrect) - }, answerState.isCorrect ? CORRECT_DELAY : WRONG_DELAY) - - return () => { - clearAutoNextTimer() - } - }, [answerState, currentQuestionId]) - const handleSelect = (domainId: string) => { if (!currentQuestion || answerState) return @@ -627,25 +594,19 @@ export default function PerformanceDomainPracticePage() { - - +
+

{currentQuestion.text}

- - +
+
{answerState && currentDomain ? ( -
+

{answerState.isCorrect - ? currentDomain.description + ? '这题已答对。' : '这题已放到后面,稍后会再出现。'}

- +
+ +
) : ( -

- 选中后会自动进入下一个。 -

+
)} @@ -714,25 +675,19 @@ export default function PerformanceDomainPracticePage() {
- - +
+

{currentQuestion.text}

- - +
+
{answerState && currentDomain ? ( -
+

{answerState.isCorrect - ? currentDomain.description + ? '这题已答对。' : '这题已放到后面,稍后会再出现。'}

- +
+ +
) : ( -

- 选中后会自动进入下一个。 -

+
)}