diff --git a/components/QuizEditor.tsx b/components/QuizEditor.tsx index d1cd804..718da13 100644 --- a/components/QuizEditor.tsx +++ b/components/QuizEditor.tsx @@ -1,6 +1,6 @@ import React, { useState, useEffect, useCallback } from 'react'; import { motion, AnimatePresence } from 'framer-motion'; -import { ArrowLeft, Save, Plus, Play, AlertTriangle } from 'lucide-react'; +import { ArrowLeft, Save, Plus, Play, AlertTriangle, List, Settings } from 'lucide-react'; import { DndContext, closestCenter, KeyboardSensor, PointerSensor, useSensor, useSensors, DragEndEvent } from '@dnd-kit/core'; import { arrayMove, SortableContext, sortableKeyboardCoordinates, verticalListSortingStrategy } from '@dnd-kit/sortable'; import { Quiz, Question, GameConfig, DEFAULT_GAME_CONFIG } from '../types'; @@ -40,6 +40,7 @@ export const QuizEditor: React.FC = ({ initialQuiz.config || defaultConfig || DEFAULT_GAME_CONFIG ); const [hasAppliedDefaultConfig, setHasAppliedDefaultConfig] = useState(!!initialQuiz.config); + const [activeTab, setActiveTab] = useState<'questions' | 'settings'>('questions'); useEffect(() => { if (!hasAppliedDefaultConfig && defaultConfig && defaultConfig !== DEFAULT_GAME_CONFIG) { @@ -215,60 +216,96 @@ export const QuizEditor: React.FC = ({
-
-
-

Questions

- -
- - + + +
- {quiz.questions.length === 0 && ( -
-

No questions yet

-

Click "Add Question" to get started

+
+ {activeTab === 'questions' ? ( + <> +
+

Questions

+ +
+ + + q.id)} + strategy={verticalListSortingStrategy} + > +
+ + {quiz.questions.map((question, index) => ( + setExpandedId(expandedId === question.id ? null : question.id)} + onEdit={() => setEditingQuestion(question)} + onDelete={() => quiz.questions.length > 1 ? setShowDeleteConfirm(question.id) : null} + /> + ))} + +
+
+
+ + {quiz.questions.length === 0 && ( +
+

No questions yet

+

Click "Add Question" to get started

+
+ )} + + ) : ( +
+

Game Settings

+
)}
- -