import { useState, useEffect } from 'react'; import { Play, Check, X, Share2, RefreshCw, Clock } from 'lucide-react'; export default function TikTokKnowledgeQuiz() { const [gameState, setGameState] = useState('start'); // start, playing, result const [currentQuestion, setCurrentQuestion] = useState(0); const [score, setScore] = useState(0); const [selectedAnswer, setSelectedAnswer] = useState(null); const [timeLeft, setTimeLeft] = useState(15); const [isAnswered, setIsAnswered] = useState(false); const [shuffledQuestions, setShuffledQuestions] = useState([]); // TikTok quiz questions - removed filter questions const questions = [ { question: "What dance trend featured people dancing to 'Savage' by Megan Thee Stallion?", options: ["Renegade", "Savage Challenge", "Say So Dance", "Blinding Lights Challenge"], correct: 1, explanation: "The Savage Challenge went viral in 2020 with choreography by Keara Wilson." }, { question: "Which food trend involved making whipped coffee?", options: ["Pancake Cereal", "Dalgona Coffee", "Feta Pasta", "Cloud Bread"], correct: 1, explanation: "Dalgona Coffee became popular during early 2020 lockdowns." }, { question: "Which song by Lizzo sparked a dance challenge where people toss their hair?", options: ["Truth Hurts", "Good As Hell", "About Damn Time", "Juice"], correct: 2, explanation: "The 'About Damn Time' choreography by Jaeden Gomez went viral in 2022." }, { question: "What trend involves people transforming into their 'glow up' selves?", options: ["Level Up", "Transformation Tuesday", "Glow Up Challenge", "Version 2.0"], correct: 2, explanation: "The Glow Up Challenge shows dramatic before and after transformations." }, { question: "Which viral sound starts with 'Bored in the house, and I'm in the house bored'?", options: ["Curtis Roach", "Charli D'Amelio", "Addison Rae", "Bella Poarch"], correct: 0, explanation: "Curtis Roach created this viral sound during pandemic lockdowns." }, { question: "What dance trend is set to the song 'Supalonely' by BENEE?", options: ["The Renegade", "Say So Dance", "Supalonely Dance", "Cannibal Dance"], correct: 2, explanation: "The Supalonely dance became popular in early 2020." }, { question: "Which food trend involves a block of feta cheese and cherry tomatoes?", options: ["TikTok Pasta", "Feta Pasta", "Baked Feta", "Tomato Surprise"], correct: 1, explanation: "Feta Pasta (or TikTok Pasta) became so popular it caused feta shortages." }, { question: "Which viral challenge involves people showing their profile from both sides?", options: ["Silhouette Challenge", "Profile Check", "Side to Side", "Symmetry Check"], correct: 3, explanation: "The Symmetry Check trend has users showing both sides of their face." }, // New questions replacing filter questions { question: "What TikTok trend had people stacking tiny pancakes in a bowl with syrup?", options: ["Breakfast Bowl", "Mini Pancakes", "Pancake Cereal", "Tiny Food"], correct: 2, explanation: "Pancake Cereal was a popular food trend where people made tiny pancakes and ate them like cereal." }, { question: "Which viral TikTok song includes the lyrics 'Don't show up, don't come out'?", options: ["Drivers License", "Savage Love", "Mood", "Levitating"], correct: 0, explanation: "Olivia Rodrigo's 'Drivers License' became a massive TikTok hit with these lyrics." } ]; // Shuffle questions on game start useEffect(() => { if (gameState === 'start') { const shuffled = [...questions].sort(() => Math.random() - 0.5); setShuffledQuestions(shuffled); } }, [gameState]); // Timer countdown useEffect(() => { let timer; if (gameState === 'playing' && !isAnswered && timeLeft > 0) { timer = setTimeout(() => setTimeLeft(timeLeft - 1), 1000); } else if (timeLeft === 0 && !isAnswered) { handleAnswer(null); } return () => clearTimeout(timer); }, [gameState, timeLeft, isAnswered]); const startGame = () => { setGameState('playing'); setCurrentQuestion(0); setScore(0); setTimeLeft(15); setIsAnswered(false); setSelectedAnswer(null); }; const handleAnswer = (index) => { setSelectedAnswer(index); setIsAnswered(true); if (index === shuffledQuestions[currentQuestion].correct) { setScore(score + 1); } setTimeout(() => { if (currentQuestion < shuffledQuestions.length - 1) { setCurrentQuestion(currentQuestion + 1); setSelectedAnswer(null); setIsAnswered(false); setTimeLeft(15); } else { setGameState('result'); } }, 2000); }; const getKnowledgeLevel = () => { const percentage = (score / questions.length) * 100; if (percentage >= 90) return "TikTok Expert"; if (percentage >= 70) return "TikTok Enthusiast"; if (percentage >= 50) return "Casual TikToker"; if (percentage >= 30) return "TikTok Newbie"; return "TikTok Outsider"; }; const getKnowledgeDescription = () => { const percentage = (score / questions.length) * 100; if (percentage >= 90) return "You're basically TikTok royalty! You know all the trends before they even go viral."; if (percentage >= 70) return "You definitely spend a good amount of time on TikTok and stay up to date with most trends."; if (percentage >= 50) return "You enjoy TikTok and catch some trends, but you might miss others."; if (percentage >= 30) return "You occasionally check TikTok but aren't keeping up with most trends."; return "You might need to download TikTok and start scrolling!"; }; return (

TikTok Knowledge Quiz

How well do you know TikTok trends?

{gameState === 'start' && (
TikTok Logo

Test Your TikTok Knowledge

Answer 10 questions about viral TikTok trends, dances, and challenges to see how much of a TikTok expert you really are!

)} {gameState === 'playing' && (
{/* Progress bar */}
Question {currentQuestion + 1}/{questions.length}
{timeLeft}s

{shuffledQuestions[currentQuestion].question}

{shuffledQuestions[currentQuestion].options.map((option, index) => ( ))}
{isAnswered && (

{selectedAnswer === shuffledQuestions[currentQuestion].correct ? "Correct! " : "Incorrect! "} {shuffledQuestions[currentQuestion].explanation}

)}
)} {gameState === 'result' && (

Quiz Complete!

{score}/{questions.length}

{getKnowledgeLevel()}

{getKnowledgeDescription()}

)}
Created with Sitebrew.ai • Not affiliated with TikTok
); }