11'use client' ;
22
3- import React , { useCallback } from 'react' ;
3+ import React , { useCallback , useState , useEffect } from 'react' ;
44import { useTranslation } from 'react-i18next' ;
55import { getTextDirection , useLanguage } from 'app/hooks/useLanguage' ;
66import useTextGeneratorStore from 'app/store/textGeneratorStore' ;
7- import { InformationCircleIcon } from '@heroicons/react/24/outline' ;
7+ import {
8+ InformationCircleIcon ,
9+ QuestionMarkCircleIcon ,
10+ CheckCircleIcon ,
11+ XCircleIcon ,
12+ } from '@heroicons/react/24/outline' ;
813import type { QuizData } from 'app/domain/schemas' ;
914import type { Language } from 'app/domain/language' ;
1015import { LanguageSchema } from 'app/domain/language' ;
@@ -45,7 +50,9 @@ const QuizOptionButton: React.FC<QuizOptionButtonProps> = ({
4550 key = { optionKey }
4651 onClick = { handleAsyncClick ( optionKey ) }
4752 disabled = { isAnswered || isSubmittingAnswer }
48- className = { `w-full text-left p-3 rounded-md border transition-colors relative ${
53+ className = { `w-full text-left min-h-[44px] p-4 md:p-5 rounded-lg border-2 transition-all duration-200 transform relative text-base md:text-lg touch-manipulation ${
54+ ! isAnswered && ! isSubmittingAnswer ? 'hover:scale-[1.02] hover:shadow-lg' : ''
55+ } ${
4956 isAnswered && feedback . correctAnswer
5057 ? optionKey === feedback . correctAnswer
5158 ? 'bg-green-900/50 border-green-700 text-green-100'
@@ -164,6 +171,16 @@ const QuizSection = () => {
164171 isSubmittingFeedback,
165172 } = useTextGeneratorStore ( ) ;
166173 const questionLanguage = contextQuestionLanguage ;
174+ const [ showCorrectAnswer , setShowCorrectAnswer ] = useState ( false ) ;
175+
176+ useEffect ( ( ) => {
177+ if ( isAnswered ) {
178+ const timer = setTimeout ( ( ) => { setShowCorrectAnswer ( true ) ; } , 2000 ) ;
179+ return ( ) => { clearTimeout ( timer ) ; } ;
180+ } else {
181+ setShowCorrectAnswer ( false ) ;
182+ }
183+ } , [ isAnswered ] ) ;
167184 const handleAsyncClick = useCallback (
168185 ( answer : string ) => ( event : React . MouseEvent < HTMLButtonElement > ) => {
169186 event . preventDefault ( ) ;
@@ -175,9 +192,18 @@ const QuizSection = () => {
175192 return null ;
176193 }
177194 return (
178- < div className = "mt-6 space-y-4" data-testid = "quiz-section" >
195+ < div
196+ className = "pt-6 mt-6 border-t border-gray-700 lg:border-0 lg:pt-0 lg:mt-0 space-y-4"
197+ data-testid = "quiz-section"
198+ >
199+ < div className = "mb-4 p-3 bg-purple-900/20 border border-purple-700/50 rounded-lg" >
200+ < p className = "text-sm text-purple-200 flex items-center gap-2" >
201+ < QuestionMarkCircleIcon className = "w-4 h-4" />
202+ { t ( 'practice.questionPrompt' ) }
203+ </ p >
204+ </ div >
179205 < h3
180- className = "text-lg font-semibold text-white"
206+ className = "text-lg md:text-xl lg:text-2xl font-semibold text-white"
181207 data-testid = "question-text"
182208 dir = { getTextDirection ( questionLanguage ) }
183209 >
@@ -200,14 +226,37 @@ const QuizSection = () => {
200226 />
201227 ) ) }
202228 </ div >
203- < FeedbackExplanation
204- isAnswered = { isAnswered }
205- showExplanation = { showExplanation }
206- feedback = { feedback }
207- t = { t }
208- questionLanguage = { questionLanguage }
209- generatedPassageLanguage = { generatedPassageLanguage }
210- />
229+ { isAnswered && (
230+ < div className = "mt-6 space-y-4" >
231+ { /* Immediate result indicator */ }
232+ < div
233+ className = { `p-4 rounded-lg border-2 ${ feedback . isCorrect ? 'bg-green-900/30 border-green-600' : 'bg-red-900/30 border-red-600' } ` }
234+ >
235+ < div className = "flex items-center gap-3" >
236+ { feedback . isCorrect ? (
237+ < CheckCircleIcon className = "w-6 h-6 text-green-400" />
238+ ) : (
239+ < XCircleIcon className = "w-6 h-6 text-red-400" />
240+ ) }
241+ < span className = "text-lg font-semibold text-white" >
242+ { feedback . isCorrect ? t ( 'practice.correct' ) : t ( 'practice.incorrect' ) }
243+ </ span >
244+ </ div >
245+ </ div >
246+
247+ { /* Detailed explanation (shows after delay) */ }
248+ { showCorrectAnswer && (
249+ < FeedbackExplanation
250+ isAnswered = { isAnswered }
251+ showExplanation = { showExplanation }
252+ feedback = { feedback }
253+ t = { t }
254+ questionLanguage = { questionLanguage }
255+ generatedPassageLanguage = { generatedPassageLanguage }
256+ />
257+ ) }
258+ </ div >
259+ ) }
211260 < ProgressionFeedback />
212261 { isSubmittingFeedback && (
213262 < div className = "mt-4 p-4 bg-gray-700/50 border border-gray-600 rounded-lg shadow" >
0 commit comments