"use client"; import React, { useState } from "react"; import { motion, AnimatePresence } from "framer-motion"; import { Button } from "@heroui/button"; import { HeartFilledIcon } from "@/components/icons"; import { title, subtitle } from "@/components/primitives"; interface Question { question: string; options: string[]; correctIndex: number; fact: string; } const QUIZ_QUESTIONS: Question[] = [ { question: "Where did the couple first meet?", options: [ "In the Mountains", "During College", "At a Coffee Shop", "At a Wedding", ], correctIndex: 1, fact: "They were college classmates before they became soulmates!", }, { question: "How many years of beautiful journey have they shared so far?", options: ["5 Years", "7 Years", "10 Years", "12 Years"], correctIndex: 2, fact: "They have shared a decade of laughter and love!", }, { question: "What is one thing both of them deeply love?", options: ["The Mountains", "The Ocean", "City Life", "Desert Safaris"], correctIndex: 0, fact: "They both share a deep love for the mountains.", }, { question: "How did their story begin?", options: [ "As Neighbors", "As Colleagues", "As College Classmates", "Through Friends", ], correctIndex: 2, fact: "Their journey started right in the classrooms of their college.", }, { question: "Which of these describes their relationship perfectly?", options: [ "Love at first sight", "College classmates to soulmates", "Met through a dating app", "Childhood friends", ], correctIndex: 1, fact: "They truly grew together from college friends to life partners!", }, { question: "What is the theme of their next chapter?", options: [ "Starting a business", "Moving to a new city", "Writing a new chapter as one", "Going back to college", ], correctIndex: 2, fact: "After 10 years, they are finally becoming one!", }, { question: "What environment do they prefer for their adventures?", options: [ "Tropical Beaches", "Snowy Mountains", "Bustling Cities", "Forest Camping", ], correctIndex: 1, fact: "Their shared love for the mountains often leads them to snowy peaks!", }, { question: "What brings the most laughter to their journey?", options: [ "Watching Movies", "Shared Laughter & Stories", "Working together", "Competitive Gaming", ], correctIndex: 1, fact: "A decade of laughter and shared stories is the foundation of their love.", }, ]; export default function GamePage() { const [currentStep, setCurrentStep] = useState<"start" | "quiz" | "result">( "start", ); const [quizSet, setQuizSet] = useState([]); const [currentQuestionIndex, setCurrentQuestionIndex] = useState(0); const [score, setScore] = useState(0); const [showFeedback, setShowFeedback] = useState(false); const [selectedOption, setSelectedOption] = useState(null); const startQuiz = () => { // Pick 5 random questions from the pool const shuffled = [...QUIZ_QUESTIONS].sort(() => 0.5 - Math.random()); setQuizSet(shuffled.slice(0, 5)); setCurrentQuestionIndex(0); setScore(0); setCurrentStep("quiz"); setShowFeedback(false); setSelectedOption(null); }; const handleAnswer = (index: number) => { if (showFeedback) return; setSelectedOption(index); if (index === quizSet[currentQuestionIndex].correctIndex) { setScore((prev) => prev + 1); } setShowFeedback(true); }; const nextQuestion = () => { if (currentQuestionIndex < quizSet.length - 1) { setCurrentQuestionIndex((prev) => prev + 1); setShowFeedback(false); setSelectedOption(null); } else { setCurrentStep("result"); } }; return (

The Couple Quiz 

How well do you know the couple?

{currentStep === "start" && (

Ready to test your knowledge?

We'll pick 5 random questions about our 10-year journey. Can you get them all right?

)} {currentStep === "quiz" && quizSet.length > 0 && (
Question {currentQuestionIndex + 1} of {quizSet.length} Score: {score}

{quizSet[currentQuestionIndex].question}

{quizSet[currentQuestionIndex].options.map((option, idx) => { let buttonColor: "default" | "success" | "danger" = "default"; if (showFeedback) { if (idx === quizSet[currentQuestionIndex].correctIndex) { buttonColor = "success"; } else if (idx === selectedOption) { buttonColor = "danger"; } } return ( ); })}
{showFeedback && (

Did you know? {quizSet[currentQuestionIndex].fact}

)}
)} {currentStep === "result" && (
{score}

{score === quizSet.length ? "True Soulmate Friend!" : score >= 3 ? "Great Job!" : "Thanks for Playing!"}

You scored{" "} {score}{" "} out of {quizSet.length}

)}
); }