import { Button } from "@/components/ui/button"; import { Home } from "lucide-react"; import { useTranslation } from "@/hooks/useTranslation"; import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from "@/components/ui/alert-dialog"; interface RoundHeaderProps { successfulRounds: number; totalRounds: number; wrongGuesses: number; guessSequence: Array<'success' | 'wrong'>; onBack?: () => void; showConfirmDialog: boolean; setShowConfirmDialog: (show: boolean) => void; onCancel?: () => void; } export const RoundHeader = ({ successfulRounds, totalRounds, wrongGuesses, guessSequence, onBack, showConfirmDialog, setShowConfirmDialog, onCancel }: RoundHeaderProps) => { const t = useTranslation(); const currentRound = successfulRounds + wrongGuesses; const remainingRounds = totalRounds - currentRound; const isShortGame = totalRounds <= 10; const handleHomeClick = () => { if (successfulRounds > 0 || wrongGuesses > 0) { setShowConfirmDialog(true); } else { onBack?.(); } }; const handleDialogChange = (open: boolean) => { setShowConfirmDialog(open); if (!open && onBack) { onBack(); } }; // Create an array of results in sequence for games with 10 or fewer words const results = Array(totalRounds).fill('pending').map((_, index) => { return guessSequence[index] || 'pending'; }); return (