"use client"; import { useState } from "react"; interface ShortAnswerBlockProps { id: string; title?: string; prompt: string; correctAnswers: string[]; editMode: boolean; onChange: (updates: { title?: string; prompt?: string; correctAnswers?: string[] }) => void; } export default function ShortAnswerBlock({ id, title, prompt, correctAnswers, editMode, onChange }: ShortAnswerBlockProps) { const [userAnswer, setUserAnswer] = useState(""); const [submitted, setSubmitted] = useState(false); const handleReset = () => { setSubmitted(false); setUserAnswer(""); }; const isCorrect = correctAnswers.some(ans => ans.trim().toLowerCase() === userAnswer.trim().toLowerCase()); return (
{editMode ? (
onChange({ title: e.target.value })} placeholder="e.g. Critical Thinking, Quick Response..." className="w-full bg-white/5 border border-white/10 rounded-lg px-4 py-2 text-sm font-bold focus:border-blue-500/50 focus:outline-none" />
) : (

{title || "Short Answer"}

)}
{editMode ? (