diff --git a/src/components/gameplay/Question.tsx b/src/components/gameplay/Question.tsx index b103e2a..d929d48 100644 --- a/src/components/gameplay/Question.tsx +++ b/src/components/gameplay/Question.tsx @@ -16,12 +16,19 @@ const Question: React.FC = ({ return `${mins.toString().padStart(2, '0')} : ${secs.toString().padStart(2, '0')}`; }; + const isTimeWarning = timeLeft <= 30; + return (
Timer - + {formatTime(timeLeft)}
diff --git a/src/components/gameplay/QuestionContainer.tsx b/src/components/gameplay/QuestionContainer.tsx index 19fcfd8..135a553 100644 --- a/src/components/gameplay/QuestionContainer.tsx +++ b/src/components/gameplay/QuestionContainer.tsx @@ -63,8 +63,15 @@ const QuestionContainer: React.FC = ({ setTimeLeft(prev => (prev <= 1 ? 0 : prev - 1)); }, 1000); return () => clearInterval(interval); + } else if (timeLeft === 0 && !isSubmitted) { + // Auto-submit as incorrect when time runs out + setIsSubmitted(true); + const progressDelay = setTimeout(() => { + onAnswerSubmit?.('', false, timeLimit); + }, 1500); + return () => clearTimeout(progressDelay); } - }, [timeLeft, isSubmitted]); + }, [timeLeft, isSubmitted, timeLimit, onAnswerSubmit]); // Map raw data to the visual states your UI uses const formattedAnswers: AnswerState[] = answers.map((answer, index) => ({