import React from 'react'; import { motion, AnimatePresence } from 'framer-motion'; import { useGenerate } from '../GenerateContext'; import { Button } from '../../../components/ui/Button'; import { ChevronDown, SlidersHorizontal, BrainCircuit, Activity, LayoutTemplate, Layers, Plus, Minimize2, Check, Trash2 } from 'lucide-react'; import { cn } from '../../../../src/utils/cn'; // Quick Templates Array const quickTemplates = [ { id: 'quiz', label: 'Weekly Quiz', icon: Activity, desc: 'Short, recall-focused' }, { id: 'midterm', label: 'Mid-Term Exam', icon: LayoutTemplate, desc: 'Balanced assessment' }, { id: 'final', label: 'Final Exam', icon: Layers, desc: 'Comprehensive, analytical' }, { id: 'competitive', label: 'Competitive', icon: BrainCircuit, desc: 'High difficulty, HOTS' }, { id: 'revision', label: 'Revision Test', icon: Check, desc: 'Easy, broad coverage' } ]; export const ConfigurePaperStep = () => { const { configure, setConfigure, setStep } = useGenerate(); const handleTemplateSelect = (templateId) => { let blooms = { remember: 20, understand: 20, apply: 20, analyze: 15, evaluate: 15, create: 10 }; let diff = 50; if (templateId === 'quiz') { blooms = { remember: 40, understand: 30, apply: 20, analyze: 10, evaluate: 0, create: 0 }; diff = 30; } if (templateId === 'midterm') { blooms = { remember: 20, understand: 25, apply: 25, analyze: 15, evaluate: 10, create: 5 }; diff = 50; } if (templateId === 'final') { blooms = { remember: 10, understand: 20, apply: 25, analyze: 25, evaluate: 15, create: 5 }; diff = 65; } if (templateId === 'competitive') { blooms = { remember: 5, understand: 10, apply: 20, analyze: 30, evaluate: 25, create: 10 }; diff = 85; } if (templateId === 'revision') { blooms = { remember: 40, understand: 40, apply: 10, analyze: 10, evaluate: 0, create: 0 }; diff = 25; } setConfigure(prev => ({ ...prev, quickTemplate: templateId, bloomsDistribution: blooms, difficulty: diff })); }; return (

Configure Paper Parameters

Fine-tune difficulty, structures, and cognitive depth.

{/* A. Quick Templates */}

Quick Templates

{quickTemplates.map(t => ( ))}
{/* B. Question Types */}

Question Types & Sections

{configure.questionTypes.map((qType, idx) => (
{qType.isCustom && ( )}
{ const newTypes = [...configure.questionTypes]; newTypes[idx].count = parseInt(e.target.value) || 0; setConfigure(p => ({ ...p, questionTypes: newTypes })); }} className="w-full bg-white dark:bg-[#111827] border border-slate-200 dark:border-slate-600 rounded p-1.5 text-xs text-slate-900 dark:text-white outline-none focus:border-[#4F7CFF]" />
{ const newTypes = [...configure.questionTypes]; newTypes[idx].marks = parseInt(e.target.value) || 0; setConfigure(p => ({ ...p, questionTypes: newTypes })); }} className="w-full bg-white dark:bg-[#111827] border border-slate-200 dark:border-slate-600 rounded p-1.5 text-xs text-slate-900 dark:text-white outline-none focus:border-[#4F7CFF]" />
{ const newTypes = [...configure.questionTypes]; newTypes[idx].topic = e.target.value; setConfigure(p => ({ ...p, questionTypes: newTypes })); }} placeholder="e.g Thermodynamics, Chapter 4..." title="Leave blank to use all materials uniformly" className="w-full bg-white dark:bg-[#111827] border border-slate-200 dark:border-slate-600 rounded p-1.5 text-xs text-slate-900 dark:text-white outline-none focus:border-[#4F7CFF]" />
{qType.id !== 'mcq' && (
{ const newTypes = [...configure.questionTypes]; // Ensure it doesn't exceed total questions in section let val = parseInt(e.target.value) || 0; if (val > newTypes[idx].count) val = newTypes[idx].count; newTypes[idx].internalChoices = val; setConfigure(p => ({ ...p, questionTypes: newTypes })); }} className="w-16 bg-white dark:bg-[#111827] border border-slate-200 dark:border-slate-600 rounded p-1.5 text-xs text-slate-900 dark:text-white outline-none focus:border-[#4F7CFF]" /> Questions will have an "OR" choice.
)}
))}
{/* C. Bloom's Taxonomy */}

Cognitive Level Distribution (Bloom's Taxonomy)

Control how deeply students interact with the content. High orders (Apply, Analyze) test critical thinking.

{Object.entries(configure.bloomsDistribution).map(([level, val], idx) => { const colors = ['bg-[#ff6b6b]', 'bg-[#feca57]', 'bg-[#1dd1a1]', 'bg-[#54a0ff]', 'bg-[#5f27cd]', 'bg-[#ff9ff3]']; const verbs = [ 'Define, Duplicate, List', 'Classify, Describe, Explain', 'Execute, Implement, Solve', 'Differentiate, Compare', 'Appraise, Argue, Judge', 'Design, Assemble, Construct' ]; return (
{val}%
{ const newVal = parseInt(e.target.value) || 0; const diff = newVal - val; // We want to auto-balance the other values so the sum remains 100 // (or at least handle the distribution smoothly) let otherKeys = Object.keys(configure.bloomsDistribution).filter(k => k !== level); let otherSum = otherKeys.reduce((acc, k) => acc + configure.bloomsDistribution[k], 0); let newDist = { ...configure.bloomsDistribution, [level]: newVal }; if (otherSum > 0 && newVal !== val) { // Normalize the others let scale = (100 - newVal) / otherSum; otherKeys.forEach(k => { // Distribute proportionally newDist[k] = Math.round(configure.bloomsDistribution[k] * scale); }); // Fix any rounding errors to exactly 100 let finalSum = Object.values(newDist).reduce((a, b) => a + b, 0); if (finalSum !== 100) { let adjustments = 100 - finalSum; // Adjust the largest other component to absorb rounding error let largestOther = otherKeys.sort((a, b) => newDist[b] - newDist[a])[0]; newDist[largestOther] = Math.max(0, newDist[largestOther] + adjustments); } } setConfigure(p => ({ ...p, bloomsDistribution: newDist, quickTemplate: 'Custom' })); }} className="absolute top-1/2 left-1/2 opacity-0 cursor-ns-resize appearance-none" style={{ width: '8rem', height: '4rem', transform: 'translate(-50%, -50%) rotate(-90deg)' }} />
{level} {/* Tooltip */}
{level} {verbs[idx]}
); })}
{/* D. Difficulty Control */}

Overall Difficulty

Dictates semantic complexity & distractors independently of Bloom's level.

{configure.difficulty < 33 ? 'Easy' : configure.difficulty < 66 ? 'Medium' : 'Hard'} ({configure.difficulty})
setConfigure(p => ({ ...p, difficulty: parseInt(e.target.value) || 0 }))} className="w-full h-2 rounded-full appearance-none bg-slate-200 dark:bg-slate-800 outline-none cursor-ew-resize accent-[#4F7CFF]" />
0 50 100
{/* E. Advanced Settings */}

Advanced AI Settings

{Object.entries(configure.advancedSettings).map(([key, val]) => ( ))}
); };