"use client"; import { useState } from "react"; import type { TriviaAnswer, TriviaQuestion } from "../../types/passport"; import EmptyState from "../shared/EmptyState"; import MetricCard from "../shared/MetricCard"; import ProgressBar from "../shared/ProgressBar"; import StatusPill from "../shared/StatusPill"; interface DailyTriviaScreenProps { questions: TriviaQuestion[]; answers: Record; onAnswer: (questionId: string, selectedIndex: number, correct: boolean) => void; } export default function DailyTriviaScreen({ questions, answers, onAnswer, }: DailyTriviaScreenProps) { const [currentIndex, setCurrentIndex] = useState(0); if (questions.length === 0) { return (
); } const currentQuestion = questions[currentIndex]; const currentAnswer = answers[currentQuestion.id]; const answeredCount = Object.keys(answers).length; const correctCount = Object.values(answers).filter((answer) => answer.correct).length; function handleAnswer(optionIndex: number) { if (currentAnswer) { return; } onAnswer(currentQuestion.id, optionIndex, optionIndex === currentQuestion.answerIndex); } function goNext() { setCurrentIndex((current) => (current + 1) % questions.length); } return (

Daily trivia

Protect the quiz streak.

Trivia turns football knowledge into a daily ritual with instant explanations, points, streak pressure, and future sponsor reward hooks.

{currentQuestion.category} {currentQuestion.difficulty}
{currentQuestion.points} pts

Question {currentIndex + 1}: {currentQuestion.prompt}

{currentQuestion.options.map((option, index) => { const isSelected = currentAnswer?.selectedIndex === index; const isCorrectOption = currentQuestion.answerIndex === index; const stateClass = currentAnswer ? isCorrectOption ? "is-correct" : isSelected ? "is-wrong" : "" : ""; return ( ); })}
{currentAnswer ? (
{currentAnswer.correct ? "Correct" : "Not this time"}

{currentQuestion.explanation}

) : (

Choose an answer to reveal the explanation.

)}
); }