1- // src/components/quiz/quiz-editor.tsx
21import { ArrowDownToLineIcon , PlusIcon } from "lucide-react" ;
32import { useEffect , useMemo , useState } from "react" ;
43
@@ -35,7 +34,6 @@ interface QuizEditorProps {
3534 saving ?: boolean ;
3635}
3736
38- // Utility to strip advanced fields when advancedMode is disabled per question
3937const sanitizeQuestions = ( questions : ( Question & { advanced ?: boolean } ) [ ] ) =>
4038 questions . map ( ( q ) => {
4139 const isAdvanced = Boolean ( q . advanced ) ;
@@ -65,7 +63,6 @@ export function QuizEditor({
6563 onSaveAndClose,
6664 saving = false ,
6765} : QuizEditorProps ) {
68- // default advanced for existing quiz: if any question had advanced fields
6966 const initialAdvancedDefault =
7067 initialQuiz ?. questions ?. some (
7168 ( q ) =>
@@ -85,7 +82,7 @@ export function QuizEditor({
8582 if ( initialQuiz ?. questions != null && initialQuiz . questions . length > 0 ) {
8683 return initialQuiz . questions . map ( ( q ) => ( {
8784 ...q ,
88- // preserve per-question advanced if present, otherwise infer from content or global default
85+
8986 advanced :
9087 Boolean ( ( q as unknown as Q ) . advanced ) ||
9188 Boolean ( q . image ) ||
@@ -117,7 +114,6 @@ export function QuizEditor({
117114 questions . reduce ( ( max , q ) => Math . max ( q . id , max ) , 0 ) ,
118115 ) ;
119116
120- // all questions multiple toggle state (true / false / mixed null)
121117 const allQuestionsMultiple : boolean | null = useMemo ( ( ) => {
122118 if ( questions . length === 0 ) {
123119 return null ;
@@ -151,7 +147,7 @@ export function QuizEditor({
151147 ] ,
152148 image : "" ,
153149 explanation : "" ,
154- advanced : advancedMode , // use global as default for new question
150+ advanced : advancedMode ,
155151 } ,
156152 ] ) ;
157153 setPreviousQuestionId ( newId ) ;
0 commit comments