import { useState } from 'react'; import type { QuizContent } from '@/lib/types/stage'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Button } from '@/components/ui/button'; import { cn } from '@/lib/utils'; interface QuizRendererProps { readonly content: QuizContent; readonly mode: 'autonomous' | 'playback'; readonly sceneId: string; } export function QuizRenderer({ content, mode, sceneId: _sceneId }: QuizRendererProps) { const [answers, setAnswers] = useState>({}); const handleAnswerChange = (questionId: string, answer: string) => { setAnswers((prev) => ({ ...prev, [questionId]: answer })); }; return (

Quiz

{content.questions.map((question) => ( {question.question} {question.type === 'single' && question.options && (
{question.options.map((option, optIndex) => { // Normalize: options may be QuizOption objects or plain strings from AI const optionValue = typeof option === 'string' ? option : option.value; const optionLabel = typeof option === 'string' ? option : option.label; const letterPrefix = String.fromCharCode(65 + optIndex); // A, B, C, D... return ( ); })}
)} {question.type === 'short_answer' && (