From e726e760c27d4e214b16536d8025dc4ee97ff894 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20Boduro=C4=9Flu?= <80620802+burakboduroglu@users.noreply.github.com> Date: Sat, 19 Sep 2026 21:27:01 +0300 Subject: [PATCH] =?UTF-8?q?style:=20=F0=9F=92=84=20exam=20question=20panel?= =?UTF-8?q?=20and=20flush=20table=20headers=20-=20exam=20"add/edit=20quest?= =?UTF-8?q?ion"=20opens=20in=20the=20wide=20side=20panel=20instead=20of=20?= =?UTF-8?q?a=20centred=20=20=20dialog=20whose=20footer=20covered=20the=20s?= =?UTF-8?q?crolling=20form=20-=20form=20footer=20reaches=20over=20the=20pa?= =?UTF-8?q?nel's=20bottom=20padding,=20right-aligned=20actions,=20=20=20an?= =?UTF-8?q?d=20a=20hint=20that=20tapping=20a=20letter=20marks=20the=20corr?= =?UTF-8?q?ect=20answer=20-=20sectioned=20DataTable=20frame=20drops=20its?= =?UTF-8?q?=20inner=20padding,=20so=20the=20header=20row=20sits=20=20=20fl?= =?UTF-8?q?ush=20on=20the=20card=20edge=20and=20the=20sticky=20header=20no?= =?UTF-8?q?=20longer=20lets=20rows=20show=20above=20it=20-=20includes=20th?= =?UTF-8?q?e=20i18n=20keys=20for=20the=20question=20generator=20that=20fol?= =?UTF-8?q?lows?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/exams/exam-questions-panel.tsx | 22 +++++++++----- src/components/exams/question-form.tsx | 28 +++++++++++------- src/components/ui/data-table.tsx | 6 +++- src/i18n/locales/en.ts | 29 ++++++++++++++++++- src/i18n/locales/tr.ts | 29 ++++++++++++++++++- src/i18n/messages.ts | 27 +++++++++++++++++ 6 files changed, 120 insertions(+), 21 deletions(-) diff --git a/src/components/exams/exam-questions-panel.tsx b/src/components/exams/exam-questions-panel.tsx index 51d7946..5c476a6 100644 --- a/src/components/exams/exam-questions-panel.tsx +++ b/src/components/exams/exam-questions-panel.tsx @@ -19,7 +19,6 @@ import { Alert } from "@/components/ui/alert"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { ConfirmDialog } from "@/components/ui/confirm-dialog"; -import { FormDialog } from "@/components/ui/form-dialog"; import { SidePanel } from "@/components/ui/side-panel"; import { BankQuestionPicker } from "@/components/exams/bank-question-picker"; import { QuestionForm, type QuestionValues } from "@/components/exams/question-form"; @@ -290,16 +289,23 @@ export function ExamQuestionsPanel(props: { /> - { if (!open) { - setEditing(null); - setFormOpen(false); + closeAfterGesture(() => { + setEditing(null); + setFormOpen(false); + }); } }} title={editing() ? t("questions.edit") : t("questions.add")} - description={t("questions.title")} + description={editing() ? t("questions.editHelp") : t("questions.addHelp")} > `/api/exams/${props.examId}/questions/${editing()?.id}/choices/${choiceId}/image`} loadImageBlob={editing() ? () => getExamQuestionImageBlob(props.examId, editing()!.id) : undefined} onCancel={() => { - // In-body Cancel bypasses FormDialog's deferred onOpenChange, so - // defer here too — otherwise the same tap can reopen the form. + // Deferred like the panel's own close — otherwise the same tap + // can land on the trigger underneath and reopen the form. closeAfterGesture(() => { setEditing(null); setFormOpen(false); @@ -318,7 +324,7 @@ export function ExamQuestionsPanel(props: { }} onSubmit={submit} /> - + {error() &&

{error()}

} diff --git a/src/components/exams/question-form.tsx b/src/components/exams/question-form.tsx index f50a7c0..156bb0d 100644 --- a/src/components/exams/question-form.tsx +++ b/src/components/exams/question-form.tsx @@ -58,6 +58,8 @@ export type QuestionFormInitial = { export function QuestionForm(props: { initial?: QuestionFormInitial; + /** Starting text/kind for a new question (an AI-generated draft); ignored when `initial` is set. */ + draft?: { text: string; kind: QuestionKind }; subjects: Subject[]; /** True while `subjects` is still loading, so a missing subject is not misreported. */ subjectsPending?: boolean; @@ -72,10 +74,10 @@ export function QuestionForm(props: { }) { const t = useT(); let textAreaRef: HTMLTextAreaElement | undefined; - const [text, setText] = createSignal(props.initial?.text ?? ""); + const [text, setText] = createSignal(props.initial?.text ?? props.draft?.text ?? ""); // No first-subject default: the subject is submitted, so the user picks it. const [subjectId, setSubjectId] = createSignal(props.initial?.subject ?? ""); - const [kind, setKind] = createSignal(props.initial?.kind ?? "choice"); + const [kind, setKind] = createSignal(props.initial?.kind ?? props.draft?.kind ?? "choice"); const [points, setPoints] = createSignal(String(props.initial?.points ?? 1)); const [choiceSet, setChoiceSet] = createSignal( props.initial ? storedChoiceSet(props.initial.choices, props.initial.correct) : blankChoiceSet(), @@ -99,9 +101,9 @@ export function QuestionForm(props: { createEffect(() => { const initial = props.initial; untrack(() => { - setText(initial?.text ?? ""); + setText(initial?.text ?? props.draft?.text ?? ""); setSubjectId(initial?.subject ?? ""); - setKind(initial?.kind ?? "choice"); + setKind(initial?.kind ?? props.draft?.kind ?? "choice"); setPoints(String(initial?.points ?? 1)); setChoiceSet(initial ? storedChoiceSet(initial.choices, initial.correct) : blankChoiceSet()); setImage(null); @@ -380,7 +382,10 @@ export function QuestionForm(props: {
- +
+ +

{t("questions.correctHint")}

+
- +
); diff --git a/src/components/ui/data-table.tsx b/src/components/ui/data-table.tsx index 1f82f94..2fc1143 100644 --- a/src/components/ui/data-table.tsx +++ b/src/components/ui/data-table.tsx @@ -400,7 +400,11 @@ export function DataTable(props: DataTableProps - + {/* No inner padding: the header row sits flush on the card's top edge. + A padded frame left it floating inside the card, and the sticky + header then pinned below that padding while rows scrolled through + the gap above it. */} +