import { useState, useEffect, useRef } from 'react';
import { Check, X, RefreshCw, Trophy, Clock, Volume2, VolumeX, Music, List, User, Award } from 'lucide-react';
export default function KanyeOrHitlerGame() {
// Game state
const [quotes, setQuotes] = useState([
{
text: "The only thing that I would like to be a slave to is my creativity.",
author: "Kanye",
answered: false,
correct: null,
difficulty: "Hard"
},
{
text: "I am the voice of a generation.",
author: "Kanye",
answered: false,
correct: null,
difficulty: "Medium"
},
{
text: "Humanitarianism is the expression of stupidity and cowardice.",
author: "Hitler",
answered: false,
correct: null,
difficulty: "Medium"
},
{
text: "I liberate minds with my music. That's more important than liberating a few people from apartheid or whatever.",
author: "Kanye",
answered: false,
correct: null,
difficulty: "Hard"
},
{
text: "The receptivity of the masses is very limited, their intelligence is small, but their power of forgetting is enormous.",
author: "Hitler",
answered: false,
correct: null,
difficulty: "Hard"
},
{
text: "Sometimes people write novels and they just be so wordy and so self-absorbed. I am not a fan of books.",
author: "Kanye",
answered: false,
correct: null,
difficulty: "Medium"
},
{
text: "Anyone who sees and paints a sky green and fields blue ought to be sterilized.",
author: "Hitler",
answered: false,
correct: null,
difficulty: "Hard"
},
{
text: "I feel like I'm too busy writing history to read it.",
author: "Kanye",
answered: false,
correct: null,
difficulty: "Medium"
},
{
text: "If you win, you need not have to explain. If you lose, you should not be there to explain.",
author: "Hitler",
answered: false,
correct: null,
difficulty: "Hard"
},
{
text: "I'm a creative genius and there's no other way to word it.",
author: "Kanye",
answered: false,
correct: null,
difficulty: "Medium"
},
{
text: "The art of reading consists in remembering the essentials and forgetting non-essentials.",
author: "Hitler",
answered: false,
correct: null,
difficulty: "Hard"
},
{
text: "For me, money is not my definition of success; inspiring people is a definition of success.",
author: "Kanye",
answered: false,
correct: null,
difficulty: "Hard"
},
{
text: "Strength lies not in defense but in attack.",
author: "Hitler",
answered: false,
correct: null,
difficulty: "Medium"
},
{
text: "People always tell you, 'Be humble. Be humble.' When was the last time someone told you to be amazing?",
author: "Kanye",
answered: false,
correct: null,
difficulty: "Medium"
},
{
text: "Words build bridges into unexplored regions.",
author: "Hitler",
answered: false,
correct: null,
difficulty: "Hard"
},
]);
const [currentQuoteIndex, setCurrentQuoteIndex] = useState(0);
const [score, setScore] = useState(0);
const [gameOver, setGameOver] = useState(false);
const [showAnswer, setShowAnswer] = useState(false);
const [timeLeft, setTimeLeft] = useState(null);
const [timerActive, setTimerActive] = useState(false);
const [gameStarted, setGameStarted] = useState(false);
const [difficulty, setDifficulty] = useState("normal");
const [username, setUsername] = useState("");
const [usernameError, setUsernameError] = useState("");
const [showLeaderboard, setShowLeaderboard] = useState(false);
const [leaderboard, setLeaderboard] = useState([]);
const [startTime, setStartTime] = useState(null);
const [totalTime, setTotalTime] = useState(0);
const [muted, setMuted] = useState(false);
const [showWelcome, setShowWelcome] = useState(true);
// Audio references
const audioRef = useRef(null);
// Load leaderboard from localStorage
useEffect(() => {
const savedLeaderboard = localStorage.getItem('kanyeHitlerLeaderboard');
if (savedLeaderboard) {
setLeaderboard(JSON.parse(savedLeaderboard));
}
}, []);
// Save leaderboard to localStorage when it changes
useEffect(() => {
if (leaderboard.length > 0) {
localStorage.setItem('kanyeHitlerLeaderboard', JSON.stringify(leaderboard));
}
}, [leaderboard]);
// Shuffle quotes at the beginning
useEffect(() => {
const shuffledQuotes = [...quotes].sort(() => Math.random() - 0.5);
setQuotes(shuffledQuotes);
}, []);
// Timer effect
useEffect(() => {
let timer;
if (timerActive && timeLeft > 0) {
timer = setTimeout(() => setTimeLeft(timeLeft - 1), 1000);
} else if (timerActive && timeLeft === 0) {
handleTimeout();
}
return () => clearTimeout(timer);
}, [timeLeft, timerActive]);
// Calculate total time
useEffect(() => {
let timeTracker;
if (gameStarted && !gameOver && startTime) {
timeTracker = setInterval(() => {
setTotalTime(Math.floor((Date.now() - startTime) / 1000));
}, 1000);
}
return () => clearInterval(timeTracker);
}, [gameStarted, gameOver, startTime]);
// Handle audio setup
useEffect(() => {
if (gameStarted && audioRef.current) {
audioRef.current.volume = 0.3;
audioRef.current.loop = true;
if (!muted) {
audioRef.current.play().catch(e => console.log("Audio play failed:", e));
}
}
return () => {
if (audioRef.current) {
audioRef.current.pause();
}
};
}, [gameStarted, muted]);
const toggleMute = () => {
setMuted(!muted);
if (audioRef.current) {
if (muted) {
audioRef.current.play().catch(e => console.log("Audio play failed:", e));
} else {
audioRef.current.pause();
}
}
};
const handleTimeout = () => {
const updatedQuotes = [...quotes];
const currentQuote = updatedQuotes[currentQuoteIndex];
currentQuote.answered = true;
currentQuote.correct = false;
setQuotes(updatedQuotes);
setShowAnswer(true);
setTimerActive(false);
setTimeout(() => {
if (currentQuoteIndex < quotes.length - 1) {
setCurrentQuoteIndex(currentQuoteIndex + 1);
setShowAnswer(false);
if (difficulty !== "easy") {
setTimeLeft(difficulty === "hard" ? 10 : 15);
setTimerActive(true);
}
} else {
setGameOver(true);
addScoreToLeaderboard();
}
}, 1500);
};
const validateUsername = () => {
if (!username.trim()) {
setUsernameError("Please enter a username");
return false;
}
if (username.length < 3) {
setUsernameError("Username must be at least 3 characters");
return false;
}
setUsernameError("");
return true;
};
const startGame = (selectedDifficulty) => {
if (!validateUsername()) return;
setDifficulty(selectedDifficulty);
setGameStarted(true);
setShowWelcome(false);
setStartTime(Date.now());
if (selectedDifficulty !== "easy") {
setTimeLeft(selectedDifficulty === "hard" ? 10 : 15);
setTimerActive(true);
}
};
const handleGuess = (guess) => {
if (showAnswer) return;
const updatedQuotes = [...quotes];
const currentQuote = updatedQuotes[currentQuoteIndex];
const isCorrect = guess === currentQuote.author;
currentQuote.answered = true;
currentQuote.correct = isCorrect;
setQuotes(updatedQuotes);
setShowAnswer(true);
setTimerActive(false);
if (isCorrect) {
setScore(score + 1);
}
// Move to next quote after 1.5 seconds
setTimeout(() => {
if (currentQuoteIndex < quotes.length - 1) {
setCurrentQuoteIndex(currentQuoteIndex + 1);
setShowAnswer(false);
if (difficulty !== "easy") {
setTimeLeft(difficulty === "hard" ? 10 : 15);
setTimerActive(true);
}
} else {
setGameOver(true);
addScoreToLeaderboard();
}
}, 1500);
};
const addScoreToLeaderboard = () => {
const difficultyMultiplier = difficulty === "easy" ? 1 : difficulty === "normal" ? 1.5 : 2;
const timeBonus = difficulty !== "easy" ? Math.max(0, 300 - totalTime) : 0;
const calculatedScore = Math.round((score / quotes.length) * 1000 * difficultyMultiplier + timeBonus);
const newScore = {
username,
score: calculatedScore,
correct: score,
total: quotes.length,
difficulty,
time: totalTime,
date: new Date().toISOString()
};
const newLeaderboard = [...leaderboard, newScore].sort((a, b) => b.score - a.score).slice(0, 10);
setLeaderboard(newLeaderboard);
};
const resetGame = () => {
const shuffledQuotes = [...quotes].map(quote => ({
...quote,
answered: false,
correct: null
})).sort(() => Math.random() - 0.5);
setQuotes(shuffledQuotes);
setCurrentQuoteIndex(0);
setScore(0);
setGameOver(false);
setShowAnswer(false);
setGameStarted(false);
setTimerActive(false);
setTimeLeft(null);
setShowLeaderboard(false);
setTotalTime(0);
setStartTime(null);
setShowWelcome(true);
};
const currentQuote = quotes[currentQuoteIndex];
// Calculate progress percentage
const progressPercentage = ((currentQuoteIndex) / (quotes.length - 1)) * 100;
// Format time display
const formatTime = (seconds) => {
const mins = Math.floor(seconds / 60);
const secs = seconds % 60;
return `${mins}:${secs < 10 ? '0' : ''}${secs}`;
};
// Welcome screen
if (showWelcome) {
return (
CONTROVERSIAL QUOTES
Kanye or Hitler?
The ultimate quote guessing game
Enter Your Username
setUsername(e.target.value)}
placeholder="Your username"
className="w-full pl-10 pr-4 py-3 bg-gray-700/70 border border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-amber-500 focus:border-transparent"
/>
{usernameError && (
{usernameError}
)}
Choose difficulty level:
startGame("easy")}
className="py-3 px-6 rounded-lg font-bold transition-all bg-emerald-600 hover:bg-emerald-700 text-white flex items-center justify-between"
>
Easy
No Timer
startGame("normal")}
className="py-3 px-6 rounded-lg font-bold transition-all bg-amber-500 hover:bg-amber-600 text-gray-900 flex items-center justify-between"
>
Normal
15 Seconds Per Quote
startGame("hard")}
className="py-3 px-6 rounded-lg font-bold transition-all bg-red-600 hover:bg-red-700 text-white flex items-center justify-between"
>
Hard
10 Seconds Per Quote
setShowLeaderboard(true)}
className="flex items-center gap-2 text-amber-400 hover:text-amber-300 transition-colors"
>
View Leaderboard
Can you tell who said what? Test your knowledge of controversial quotes!
{/* Leaderboard Modal */}
{showLeaderboard && (
Leaderboard
setShowLeaderboard(false)}
className="text-gray-400 hover:text-white"
>
{leaderboard.length === 0 ? (
No scores yet. Be the first to play!
) : (
{leaderboard.map((entry, index) => (
{index === 0 ? (
🥇
) : index === 1 ? (
🥈
) : index === 2 ? (
🥉
) : (
{index + 1}
)}
{entry.username}
{entry.correct}/{entry.total} correct
•
{entry.difficulty}
•
{formatTime(entry.time)}
{entry.score}
))}
)}
setShowLeaderboard(false)}
className="w-full mt-6 py-2 bg-gray-700 hover:bg-gray-600 rounded-lg text-center"
>
Close
)}
);
}
return (
{/* Audio element */}
{muted ? : }
setShowLeaderboard(true)}
className="bg-gray-800/80 p-2 rounded-full hover:bg-gray-700/80 transition-colors"
aria-label="Show Leaderboard"
>
Kanye or Hitler?
{username} is playing
{difficulty}
{!gameOver ? (
<>
{timeLeft !== null && (
{timeLeft}s
)}
Total: {formatTime(totalTime)}
{currentQuoteIndex + 1}/{quotes.length}
{/* Progress bar */}
{currentQuote.difficulty && (
{currentQuote.difficulty}
)}
"{currentQuote.text}"
{showAnswer && (
Said by:
{currentQuote.author}
{currentQuote.correct
?
:
}
{currentQuote.correct
? "Correct! Well done."
: `Wrong! This was actually said by ${currentQuote.author}.`
}
)}
handleGuess("Kanye")}
disabled={showAnswer}
className={`py-4 px-6 rounded-lg font-bold transition-all ${
showAnswer
? 'opacity-50 cursor-not-allowed'
: 'bg-gradient-to-r from-amber-500 to-amber-600 hover:from-amber-600 hover:to-amber-700 text-gray-900 shadow-lg hover:shadow-amber-500/20 transform hover:-translate-y-1'
}`}
>
Kanye West
handleGuess("Hitler")}
disabled={showAnswer}
className={`py-4 px-6 rounded-lg font-bold transition-all ${
showAnswer
? 'opacity-50 cursor-not-allowed'
: 'bg-gradient-to-r from-gray-700 to-gray-800 hover:from-gray-600 hover:to-gray-700 shadow-lg hover:shadow-gray-700/20 transform hover:-translate-y-1'
}`}
>
Adolf Hitler
>
) : (
Game Over!
Your score: {score}/{quotes.length}
Completed in {formatTime(totalTime)}
{Math.round((score / quotes.length) * 1000 * (difficulty === "easy" ? 1 : difficulty === "normal" ? 1.5 : 2) + (difficulty !== "easy" ? Math.max(0, 300 - totalTime) : 0))} points
{difficulty !== "easy" && "Includes time bonus"}
{score === quotes.length ? (
Perfect score! You're an expert!
) : score >= quotes.length * 0.7 ? (
Great job! You know your quotes!
) : score >= quotes.length * 0.5 ? (
Not bad! You got half right.
) : (
Better luck next time!
)}
{score < quotes.length * 0.5
? "It's harder than it seems, isn't it? The rhetoric of extremism and ego can sound surprisingly similar."
: "Impressive! You can tell the difference between megalomania and... well, more megalomania."}
setShowLeaderboard(true)}
className="flex items-center justify-center gap-2 mx-auto bg-gray-700 hover:bg-gray-600 text-white py-3 px-6 rounded-lg font-bold shadow-lg"
>
View Leaderboard
Play Again
)}
{/* Leaderboard Modal */}
{showLeaderboard && (
Leaderboard
setShowLeaderboard(false)}
className="text-gray-400 hover:text-white"
>
{leaderboard.length === 0 ? (
No scores yet. Be the first to play!
) : (
{leaderboard.map((entry, index) => (
{index === 0 ? (
🥇
) : index === 1 ? (
🥈
) : index === 2 ? (
🥉
) : (
{index + 1}
)}
{entry.username}
{entry.correct}/{entry.total} correct
•
{entry.difficulty}
•
{formatTime(entry.time)}
{entry.score}
))}
)}
setShowLeaderboard(false)}
className="w-full mt-6 py-2 bg-gray-700 hover:bg-gray-600 rounded-lg text-center"
>
Close
)}
);
}
// Add this to your CSS
const styles = `
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
.animate-fadeIn {
animation: fadeIn 0.5s ease-in-out;
}
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.5; }
}
.animate-pulse {
animation:
import { useState, useEffect, useRef } from 'react';
import { Check, X, RefreshCw, Trophy, Clock, Volume2, VolumeX, Music, List, User, Award } from 'lucide-react';
export default function KanyeOrHitlerGame() {
// Game state
const [quotes, setQuotes] = useState([
{
text: "The only thing that I would like to be a slave to is my creativity.",
author: "Kanye",
answered: false,
correct: null,
difficulty: "Hard"
},
{
text: "I am the voice of a generation.",
author: "Kanye",
answered: false,
correct: null,
difficulty: "Medium"
},
{
text: "Humanitarianism is the expression of stupidity and cowardice.",
author: "Hitler",
answered: false,
correct: null,
difficulty: "Medium"
},
{
text: "I liberate minds with my music. That's more important than liberating a few people from apartheid or whatever.",
author: "Kanye",
answered: false,
correct: null,
difficulty: "Hard"
},
{
text: "The receptivity of the masses is very limited, their intelligence is small, but their power of forgetting is enormous.",
author: "Hitler",
answered: false,
correct: null,
difficulty: "Hard"
},
{
text: "Sometimes people write novels and they just be so wordy and so self-absorbed. I am not a fan of books.",
author: "Kanye",
answered: false,
correct: null,
difficulty: "Medium"
},
{
text: "Anyone who sees and paints a sky green and fields blue ought to be sterilized.",
author: "Hitler",
answered: false,
correct: null,
difficulty: "Hard"
},
{
text: "I feel like I'm too busy writing history to read it.",
author: "Kanye",
answered: false,
correct: null,
difficulty: "Medium"
},
{
text: "If you win, you need not have to explain. If you lose, you should not be there to explain.",
author: "Hitler",
answered: false,
correct: null,
difficulty: "Hard"
},
{
text: "I'm a creative genius and there's no other way to word it.",
author: "Kanye",
answered: false,
correct: null,
difficulty: "Medium"
},
{
text: "The art of reading consists in remembering the essentials and forgetting non-essentials.",
author: "Hitler",
answered: false,
correct: null,
difficulty: "Hard"
},
{
text: "For me, money is not my definition of success; inspiring people is a definition of success.",
author: "Kanye",
answered: false,
correct: null,
difficulty: "Hard"
},
{
text: "Strength lies not in defense but in attack.",
author: "Hitler",
answered: false,
correct: null,
difficulty: "Medium"
},
{
text: "People always tell you, 'Be humble. Be humble.' When was the last time someone told you to be amazing?",
author: "Kanye",
answered: false,
correct: null,
difficulty: "Medium"
},
{
text: "Words build bridges into unexplored regions.",
author: "Hitler",
answered: false,
correct: null,
difficulty: "Hard"
},
]);
const [currentQuoteIndex, setCurrentQuoteIndex] = useState(0);
const [score, setScore] = useState(0);
const [gameOver, setGameOver] = useState(false);
const [showAnswer, setShowAnswer] = useState(false);
const [timeLeft, setTimeLeft] = useState(null);
const [timerActive, setTimerActive] = useState(false);
const [gameStarted, setGameStarted] = useState(false);
const [difficulty, setDifficulty] = useState("normal");
const [username, setUsername] = useState("");
const [usernameError, setUsernameError] = useState("");
const [showLeaderboard, setShowLeaderboard] = useState(false);
const [leaderboard, setLeaderboard] = useState([]);
const [startTime, setStartTime] = useState(null);
const [totalTime, setTotalTime] = useState(0);
const [muted, setMuted] = useState(false);
const [showWelcome, setShowWelcome] = useState(true);
// Audio references
const audioRef = useRef(null);
// Load leaderboard from localStorage
useEffect(() => {
const savedLeaderboard = localStorage.getItem('kanyeHitlerLeaderboard');
if (savedLeaderboard) {
setLeaderboard(JSON.parse(savedLeaderboard));
}
}, []);
// Save leaderboard to localStorage when it changes
useEffect(() => {
if (leaderboard.length > 0) {
localStorage.setItem('kanyeHitlerLeaderboard', JSON.stringify(leaderboard));
}
}, [leaderboard]);
// Shuffle quotes at the beginning
useEffect(() => {
const shuffledQuotes = [...quotes].sort(() => Math.random() - 0.5);
setQuotes(shuffledQuotes);
}, []);
// Timer effect
useEffect(() => {
let timer;
if (timerActive && timeLeft > 0) {
timer = setTimeout(() => setTimeLeft(timeLeft - 1), 1000);
} else if (timerActive && timeLeft === 0) {
handleTimeout();
}
return () => clearTimeout(timer);
}, [timeLeft, timerActive]);
// Calculate total time
useEffect(() => {
let timeTracker;
if (gameStarted && !gameOver && startTime) {
timeTracker = setInterval(() => {
setTotalTime(Math.floor((Date.now() - startTime) / 1000));
}, 1000);
}
return () => clearInterval(timeTracker);
}, [gameStarted, gameOver, startTime]);
// Handle audio setup
useEffect(() => {
if (gameStarted && audioRef.current) {
audioRef.current.volume = 0.3;
audioRef.current.loop = true;
if (!muted) {
audioRef.current.play().catch(e => console.log("Audio play failed:", e));
}
}
return () => {
if (audioRef.current) {
audioRef.current.pause();
}
};
}, [gameStarted, muted]);
const toggleMute = () => {
setMuted(!muted);
if (audioRef.current) {
if (muted) {
audioRef.current.play().catch(e => console.log("Audio play failed:", e));
} else {
audioRef.current.pause();
}
}
};
const handleTimeout = () => {
const updatedQuotes = [...quotes];
const currentQuote = updatedQuotes[currentQuoteIndex];
currentQuote.answered = true;
currentQuote.correct = false;
setQuotes(updatedQuotes);
setShowAnswer(true);
setTimerActive(false);
setTimeout(() => {
if (currentQuoteIndex < quotes.length - 1) {
setCurrentQuoteIndex(currentQuoteIndex + 1);
setShowAnswer(false);
if (difficulty !== "easy") {
setTimeLeft(difficulty === "hard" ? 10 : 15);
setTimerActive(true);
}
} else {
setGameOver(true);
addScoreToLeaderboard();
}
}, 1500);
};
const validateUsername = () => {
if (!username.trim()) {
setUsernameError("Please enter a username");
return false;
}
if (username.length < 3) {
setUsernameError("Username must be at least 3 characters");
return false;
}
setUsernameError("");
return true;
};
const startGame = (selectedDifficulty) => {
if (!validateUsername()) return;
setDifficulty(selectedDifficulty);
setGameStarted(true);
setShowWelcome(false);
setStartTime(Date.now());
if (selectedDifficulty !== "easy") {
setTimeLeft(selectedDifficulty === "hard" ? 10 : 15);
setTimerActive(true);
}
};
const handleGuess = (guess) => {
if (showAnswer) return;
const updatedQuotes = [...quotes];
const currentQuote = updatedQuotes[currentQuoteIndex];
const isCorrect = guess === currentQuote.author;
currentQuote.answered = true;
currentQuote.correct = isCorrect;
setQuotes(updatedQuotes);
setShowAnswer(true);
setTimerActive(false);
if (isCorrect) {
setScore(score + 1);
}
// Move to next quote after 1.5 seconds
setTimeout(() => {
if (currentQuoteIndex < quotes.length - 1) {
setCurrentQuoteIndex(currentQuoteIndex + 1);
setShowAnswer(false);
if (difficulty !== "easy") {
setTimeLeft(difficulty === "hard" ? 10 : 15);
setTimerActive(true);
}
} else {
setGameOver(true);
addScoreToLeaderboard();
}
}, 1500);
};
const addScoreToLeaderboard = () => {
const difficultyMultiplier = difficulty === "easy" ? 1 : difficulty === "normal" ? 1.5 : 2;
const timeBonus = difficulty !== "easy" ? Math.max(0, 300 - totalTime) : 0;
const calculatedScore = Math.round((score / quotes.length) * 1000 * difficultyMultiplier + timeBonus);
const newScore = {
username,
score: calculatedScore,
correct: score,
total: quotes.length,
difficulty,
time: totalTime,
date: new Date().toISOString()
};
const newLeaderboard = [...leaderboard, newScore].sort((a, b) => b.score - a.score).slice(0, 10);
setLeaderboard(newLeaderboard);
};
const resetGame = () => {
const shuffledQuotes = [...quotes].map(quote => ({
...quote,
answered: false,
correct: null
})).sort(() => Math.random() - 0.5);
setQuotes(shuffledQuotes);
setCurrentQuoteIndex(0);
setScore(0);
setGameOver(false);
setShowAnswer(false);
setGameStarted(false);
setTimerActive(false);
setTimeLeft(null);
setShowLeaderboard(false);
setTotalTime(0);
setStartTime(null);
setShowWelcome(true);
};
const currentQuote = quotes[currentQuoteIndex];
// Calculate progress percentage
const progressPercentage = ((currentQuoteIndex) / (quotes.length - 1)) * 100;
// Format time display
const formatTime = (seconds) => {
const mins = Math.floor(seconds / 60);
const secs = seconds % 60;
return `${mins}:${secs < 10 ? '0' : ''}${secs}`;
};
// Welcome screen
if (showWelcome) {
return (
CONTROVERSIAL QUOTES
Kanye or Hitler?
The ultimate quote guessing game
Enter Your Username
setUsername(e.target.value)}
placeholder="Your username"
className="w-full pl-10 pr-4 py-3 bg-gray-700/70 border border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-amber-500 focus:border-transparent"
/>
{usernameError && (
{usernameError}
)}
Choose difficulty level:
startGame("easy")}
className="py-3 px-6 rounded-lg font-bold transition-all bg-emerald-600 hover:bg-emerald-700 text-white flex items-center justify-between"
>
Easy
No Timer
startGame("normal")}
className="py-3 px-6 rounded-lg font-bold transition-all bg-amber-500 hover:bg-amber-600 text-gray-900 flex items-center justify-between"
>
Normal
15 Seconds Per Quote
startGame("hard")}
className="py-3 px-6 rounded-lg font-bold transition-all bg-red-600 hover:bg-red-700 text-white flex items-center justify-between"
>
Hard
10 Seconds Per Quote
setShowLeaderboard(true)}
className="flex items-center gap-2 text-amber-400 hover:text-amber-300 transition-colors"
>
View Leaderboard
Can you tell who said what? Test your knowledge of controversial quotes!
{/* Leaderboard Modal */}
{showLeaderboard && (
Leaderboard
setShowLeaderboard(false)}
className="text-gray-400 hover:text-white"
>
{leaderboard.length === 0 ? (
No scores yet. Be the first to play!
) : (
{leaderboard.map((entry, index) => (
{index === 0 ? (
🥇
) : index === 1 ? (
🥈
) : index === 2 ? (
🥉
) : (
{index + 1}
)}
{entry.username}
{entry.correct}/{entry.total} correct
•
{entry.difficulty}
•
{formatTime(entry.time)}
{entry.score}
))}
)}
setShowLeaderboard(false)}
className="w-full mt-6 py-2 bg-gray-700 hover:bg-gray-600 rounded-lg text-center"
>
Close
)}
);
}
return (
{/* Audio element */}
{muted ? : }
setShowLeaderboard(true)}
className="bg-gray-800/80 p-2 rounded-full hover:bg-gray-700/80 transition-colors"
aria-label="Show Leaderboard"
>
Kanye or Hitler?
{username} is playing
{difficulty}
{!gameOver ? (
<>
{timeLeft !== null && (
{timeLeft}s
)}
Total: {formatTime(totalTime)}
{currentQuoteIndex + 1}/{quotes.length}
{/* Progress bar */}
{currentQuote.difficulty && (
{currentQuote.difficulty}
)}
"{currentQuote.text}"
{showAnswer && (
Said by:
{currentQuote.author}
{currentQuote.correct
?
:
}
{currentQuote.correct
? "Correct! Well done."
: `Wrong! This was actually said by ${currentQuote.author}.`
}
)}
handleGuess("Kanye")}
disabled={showAnswer}
className={`py-4 px-6 rounded-lg font-bold transition-all ${
showAnswer
? 'opacity-50 cursor-not-allowed'
: 'bg-gradient-to-r from-amber-500 to-amber-600 hover:from-amber-600 hover:to-amber-700 text-gray-900 shadow-lg hover:shadow-amber-500/20 transform hover:-translate-y-1'
}`}
>
Kanye West
handleGuess("Hitler")}
disabled={showAnswer}
className={`py-4 px-6 rounded-lg font-bold transition-all ${
showAnswer
? 'opacity-50 cursor-not-allowed'
: 'bg-gradient-to-r from-gray-700 to-gray-800 hover:from-gray-600 hover:to-gray-700 shadow-lg hover:shadow-gray-700/20 transform hover:-translate-y-1'
}`}
>
Adolf Hitler
>
) : (
Game Over!
Your score: {score}/{quotes.length}
Completed in {formatTime(totalTime)}
{Math.round((score / quotes.length) * 1000 * (difficulty === "easy" ? 1 : difficulty === "normal" ? 1.5 : 2) + (difficulty !== "easy" ? Math.max(0, 300 - totalTime) : 0))} points
{difficulty !== "easy" && "Includes time bonus"}
{score === quotes.length ? (
Perfect score! You're an expert!
) : score >= quotes.length * 0.7 ? (
Great job! You know your quotes!
) : score >= quotes.length * 0.5 ? (
Not bad! You got half right.
) : (
Better luck next time!
)}
{score < quotes.length * 0.5
? "It's harder than it seems, isn't it? The rhetoric of extremism and ego can sound surprisingly similar."
: "Impressive! You can tell the difference between megalomania and... well, more megalomania."}
setShowLeaderboard(true)}
className="flex items-center justify-center gap-2 mx-auto bg-gray-700 hover:bg-gray-600 text-white py-3 px-6 rounded-lg font-bold shadow-lg"
>
View Leaderboard
Play Again
)}
{/* Leaderboard Modal */}
{showLeaderboard && (
Leaderboard
setShowLeaderboard(false)}
className="text-gray-400 hover:text-white"
>
{leaderboard.length === 0 ? (
No scores yet. Be the first to play!
) : (
{leaderboard.map((entry, index) => (
{index === 0 ? (
🥇
) : index === 1 ? (
🥈
) : index === 2 ? (
🥉
) : (
{index + 1}
)}
{entry.username}
{entry.correct}/{entry.total} correct
•
{entry.difficulty}
•
{formatTime(entry.time)}
{entry.score}
))}
)}
setShowLeaderboard(false)}
className="w-full mt-6 py-2 bg-gray-700 hover:bg-gray-600 rounded-lg text-center"
>
Close
)}
);
}
// Add this to your CSS
const styles = `
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
.animate-fadeIn {
animation: fadeIn 0.5s ease-in-out;
}
`;
// Add the styles to the document
const styleElement = document.createElement('style');
styleElement.innerHTML = styles;
document.head.appendChild(styleElement);