From 41ee7b677012bf86aefad74c311a9e4bb9ef855e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Burak=20Boduro=C4=9Flu?=
<80620802+burakboduroglu@users.noreply.github.com>
Date: Mon, 20 Jul 2026 07:57:18 +0300
Subject: [PATCH] =?UTF-8?q?feat:=20=E2=9C=A8=20add=20question=20button=20i?=
=?UTF-8?q?n=20exam=20detail=20section=20header=20-=20ExamQuestionsPanel:?=
=?UTF-8?q?=20createOpen/onCreateOpenChange=20props=20for=20external=20con?=
=?UTF-8?q?trol=20-=20hide=20embedded=20Add=20button=20when=20parent=20pro?=
=?UTF-8?q?vides=20its=20own=20-=20detail=20page:=20Add=20Question=20butto?=
=?UTF-8?q?n=20in=20SectionDisclosure=20actions=20-=20allow=20question=20e?=
=?UTF-8?q?diting=20when=20exam=20is=20upcoming=20(not=20just=20in-progres?=
=?UTF-8?q?s)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/exams/exam-questions-panel.tsx | 21 ++++++++++-------
src/pages/exam-detail-page.tsx | 23 +++++++++++++++++--
2 files changed, 34 insertions(+), 10 deletions(-)
diff --git a/src/components/exams/exam-questions-panel.tsx b/src/components/exams/exam-questions-panel.tsx
index 1fffa2e..c2d4c25 100644
--- a/src/components/exams/exam-questions-panel.tsx
+++ b/src/components/exams/exam-questions-panel.tsx
@@ -23,7 +23,7 @@ import { useT } from "@/stores/preferences-context";
const QUESTION_PAGE_SIZE = 5;
-export function ExamQuestionsPanel(props: { examId: string; courseId: string; readOnly?: boolean; embedded?: boolean }) {
+export function ExamQuestionsPanel(props: { examId: string; courseId: string; readOnly?: boolean; embedded?: boolean; createOpen?: boolean; onCreateOpenChange?: (open: boolean) => void }) {
const t = useT();
const [subjects] = createResource(() => props.courseId, async (courseId) => (await getCourseSubjects(courseId)).items);
const [questions, { refetch }] = createResource(() => props.examId, async (examId) => {
@@ -41,6 +41,11 @@ export function ExamQuestionsPanel(props: { examId: string; courseId: string; re
const [imagePending, setImagePending] = createSignal("");
const [flash, setFlash] = createFlash();
const [page, setPage] = createSignal(0);
+ const formOpen = () => props.createOpen ?? showForm();
+ const setFormOpen = (open: boolean) => {
+ props.onCreateOpenChange?.(open);
+ setShowForm(open);
+ };
const formInitial = createMemo(() => editing() ?? undefined);
const questionList = createMemo(() => questions() ?? []);
@@ -55,7 +60,7 @@ export function ExamQuestionsPanel(props: { examId: string; courseId: string; re
createEffect(() => {
if (!props.readOnly) return;
setEditing(null);
- setShowForm(false);
+ setFormOpen(false);
setRemoveQuestion(null);
});
@@ -83,7 +88,7 @@ export function ExamQuestionsPanel(props: { examId: string; courseId: string; re
setFlash(t("common.created"));
}
setEditing(null);
- setShowForm(false);
+ setFormOpen(false);
await refetch();
if (isNewQuestion) setPage(Math.max(0, Math.ceil(questionList().length / QUESTION_PAGE_SIZE) - 1));
} catch (err) {
@@ -130,14 +135,14 @@ export function ExamQuestionsPanel(props: { examId: string; courseId: string; re
{t("questions.title")}
-
+