From af58a39a681e845f9b6897b8ab47f3974d2bd99f Mon Sep 17 00:00:00 2001 From: bartoszfabianowski <281041@student.pwr.edu.pl> Date: Sun, 14 Dec 2025 15:59:27 +0100 Subject: [PATCH 1/4] feat: dodanie trybu zaawansowanego per-pytanie --- src/components/quiz/question-form.tsx | 72 +++++++++++++++++------- src/components/quiz/quiz-editor.tsx | 80 ++++++++++++++++----------- 2 files changed, 102 insertions(+), 50 deletions(-) diff --git a/src/components/quiz/question-form.tsx b/src/components/quiz/question-form.tsx index 8aa7a99..1b686b3 100644 --- a/src/components/quiz/question-form.tsx +++ b/src/components/quiz/question-form.tsx @@ -1,3 +1,4 @@ +// src/components/quiz/question-form.tsx import { Trash2, TrashIcon } from "lucide-react"; import { Button } from "@/components/ui/button"; @@ -5,22 +6,23 @@ import { Checkbox } from "@/components/ui/checkbox"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"; +import { Switch } from "@/components/ui/switch"; import { Textarea } from "@/components/ui/textarea"; import type { Answer, Question } from "@/types/quiz.ts"; interface questionFormProps { - question: Question; - onUpdate: (updatedQuestion: Question) => void; + question: Question & { advanced?: boolean }; + onUpdate: (updatedQuestion: Question & { advanced?: boolean }) => void; onRemove: (id: number) => void; - advancedMode?: boolean; } export function QuestionForm({ question, onUpdate, onRemove, - advancedMode = false, }: questionFormProps) { + const isAdvanced = Boolean(question.advanced); + const handleTextChange = (text: string) => { onUpdate({ ...question, question: text }); }; @@ -53,7 +55,7 @@ export function QuestionForm({ }; const addAnswer = () => { - const newAnswer = { answer: "", correct: false, image: "" }; + const newAnswer = { answer: "", correct: false, image: "" } as Answer; onUpdate({ ...question, answers: [...question.answers, newAnswer] }); }; @@ -95,16 +97,30 @@ export function QuestionForm({ > Pytanie {question.id} - +
+
+ { + onUpdate({ ...question, advanced: checked }); + }} + /> + + Zaawansowane + +
+ +