"use client"; import { createElement } from "react"; import { motion } from "framer-motion"; import { AnswerButton } from "./AnswerButton"; import { getCategoryIcon } from "@/lib/category-icons"; import { useCosmeticContext } from "@/components/cosmetics/CosmeticProvider"; import type { ShuffledQuestion, Difficulty } from "@/lib/game/types"; type AnswerState = "idle" | "correct" | "wrong" | "disabled"; interface QuestionCardProps { question: ShuffledQuestion; answerStates: Record; onAnswer: (answer: string) => void; } const difficultyColors: Record = { easy: "bg-green-500/80", medium: "bg-gold/80 text-black", hard: "bg-red-500/80", }; export function QuestionCard({ question, answerStates, onAnswer }: QuestionCardProps) { const { equipped } = useCosmeticContext(); const hasCardTheme = equipped.card_theme !== null; const cardThemeStyle: React.CSSProperties | undefined = hasCardTheme ? { background: "var(--cosmetic-card-bg)", borderColor: "var(--cosmetic-card-border)", boxShadow: "var(--cosmetic-card-glow)", } : undefined; return (
{createElement(getCategoryIcon(question.category), { size: 14, className: "text-gray-400", })} {question.difficulty}

{question.questionText}

{question.allAnswers.map((answer, i) => ( onAnswer(answer)} index={i} showBadge={question.allAnswers.length !== 2} /> ))}
); }