import { useState, useEffect } from 'react'; import { Shuffle, Award, AlertTriangle } from 'lucide-react'; export default function QuoteGuessingGame() { const [quotes, setQuotes] = useState([]); const [currentQuoteIndex, setCurrentQuoteIndex] = useState(0); const [score, setScore] = useState(0); const [showAnswer, setShowAnswer] = useState(false); const [gameOver, setGameOver] = useState(false); const [selectedAnswer, setSelectedAnswer] = useState(null); const [loading, setLoading] = useState(true); const [fadeIn, setFadeIn] = useState(true); // Collection of verified quotes - fixed any syntax issues const quoteData = [ { text: "I am the greatest artist that God has ever created.", author: "Kanye" }, { text: "The Jews are undoubtedly a race, but they are not human.", author: "Hitler" }, { text: "I am a creative genius and there is no other way to word it.", author: "Kanye" }, { text: "Great liars are also great magicians.", author: "Hitler" }, { text: "My greatest pain in life is that I will never be able to see myself perform live.", author: "Kanye" }, { text: "If you tell a big enough lie and tell it frequently enough, it will be believed.", author: "Hitler" }, { text: "I feel like I am too busy writing history to read it.", author: "Kanye" }, { text: "The victor will never be asked if he told the truth.", author: "Hitler" }, { text: "I am Warhol. I am the No. 1 most impactful artist of our generation. I am Shakespeare in the flesh.", author: "Kanye" }, { text: "Words build bridges into unexplored regions.", author: "Hitler" }, { text: "I love sleep; it is my favorite.", author: "Kanye" }, { text: "Humanitarianism is the expression of stupidity and cowardice.", author: "Hitler" } ]; // Initialize and shuffle quotes useEffect(() => { const shuffledQuotes = [...quoteData].sort(() => Math.random() - 0.5); setQuotes(shuffledQuotes); setTimeout(() => setLoading(false), 800); // Add slight delay for loading animation }, []); const handleGuess = (author) => { if (showAnswer) return; setSelectedAnswer(author); setShowAnswer(true); if (author === quotes[currentQuoteIndex].author) { setScore(score + 1); } // Move to next quote after a delay with animation setTimeout(() => { setFadeIn(false); setTimeout(() => { if (currentQuoteIndex < quotes.length - 1) { setCurrentQuoteIndex(currentQuoteIndex + 1); setShowAnswer(false); setSelectedAnswer(null); setFadeIn(true); } else { setGameOver(true); } }, 300); }, 1500); }; const restartGame = () => { setLoading(true); setTimeout(() => { const shuffledQuotes = [...quoteData].sort(() => Math.random() - 0.5); setQuotes(shuffledQuotes); setCurrentQuoteIndex(0); setScore(0); setShowAnswer(false); setGameOver(false); setSelectedAnswer(null); setFadeIn(true); setLoading(false); }, 600); }; // Calculate percentage for score display const scorePercentage = Math.round((score / quotes.length) * 100) || 0; if (loading) { return (
Loading quotes...
); } return (
{!gameOver ? (
{/* Header with title and score */}

Who Said It?

Hitler or Kanye West

{/* Score and progress bar */}
Score
{score}/{quotes.length}
Question
{currentQuoteIndex + 1}/{quotes.length}
{/* Quote card */}
"
"

{quotes[currentQuoteIndex]?.text}

{/* Feedback area */} {showAnswer && (

{selectedAnswer === quotes[currentQuoteIndex].author ? 'Correct!' : 'Wrong!'}

{selectedAnswer === quotes[currentQuoteIndex].author ? `Yes, this was said by ${quotes[currentQuoteIndex].author}.` : `This was actually said by ${quotes[currentQuoteIndex].author}.`}

)} {/* Answer buttons */}
{/* Disclaimer */}
This game contains offensive content for educational purposes.
) : ( // Results screen

Game Over!

How well do you know your quotes?

{/* Score display */}
{scorePercentage}%
70 ? "#10b981" : scorePercentage > 40 ? "#f59e0b" : "#ef4444"} strokeWidth="8" strokeDasharray={`${scorePercentage * 2.83} 283`} strokeDashoffset="0" transform="rotate(-90 50 50)" />

Your final score: {score} out of {quotes.length}

{score === quotes.length ? (

Perfect score! You're an expert!

) : score >= quotes.length * 0.7 ? (

Great job! You know your quotes well!

) : score >= quotes.length * 0.5 ? (

Not bad! You got more than half right.

) : (

Better luck next time!

)}
{/* Play again button */}
{/* Disclaimer */}
This game contains offensive content for educational purposes.
)}
); }