import { motion } from "framer-motion"; import { useState, useEffect } from "react"; import { useTranslation } from "@/hooks/useTranslation"; import { RoundHeader } from "./sentence-builder/RoundHeader"; import { WordDisplay } from "./sentence-builder/WordDisplay"; import { GuessDescription } from "./guess-display/GuessDescription"; import { GuessResult } from "./guess-display/GuessResult"; import { ActionButtons } from "./guess-display/ActionButtons"; interface GuessDisplayProps { currentScore: number; currentWord: string; sentence: string[]; aiGuess: string; avgWordsPerRound: number; sessionId: string; currentTheme: string; onNextRound: () => void; onGameReview: () => void; onBack?: () => void; normalizeWord: (word: string) => string; } export const GuessDisplay = ({ currentScore, currentWord, sentence, aiGuess, avgWordsPerRound, sessionId, currentTheme, onNextRound, onBack, onGameReview, normalizeWord, }: GuessDisplayProps) => { const [showConfirmDialog, setShowConfirmDialog] = useState(false); const t = useTranslation(); const handleSetShowConfirmDialog = (show: boolean) => { setShowConfirmDialog(show); }; const isGuessCorrect = () => normalizeWord(aiGuess) === normalizeWord(currentWord); useEffect(() => { const handleKeyPress = (e: KeyboardEvent) => { if (e.key === 'Enter') { if (isGuessCorrect()) { onNextRound(); } else { onGameReview(); } } }; window.addEventListener('keydown', handleKeyPress); return () => window.removeEventListener('keydown', handleKeyPress); }, [isGuessCorrect, onNextRound, onGameReview]); return ( ); };