diff --git a/app/admin/form/[id]/client.tsx b/app/admin/form/[id]/client.tsx index 5672f37..5d36327 100644 --- a/app/admin/form/[id]/client.tsx +++ b/app/admin/form/[id]/client.tsx @@ -71,6 +71,11 @@ import { FieldLegend, FieldSet, } from "@/components/ui/field"; +import { + getQuestionResponseSettings, + getQuestionResponseType, + type QuestionResponseType, +} from "@/lib/question-response-type"; interface Question { id: string; @@ -241,6 +246,16 @@ export default function FormEditorClient({ form, initialQuestions }: FormEditorC questionsAutoSave.schedule(); }; + const handleResponseTypeChange = ( + question: Question, + responseType: QuestionResponseType, + ) => { + handleUpdateQuestion( + question.id, + getQuestionResponseSettings(responseType, question.required), + ); + }; + const handleDeleteQuestion = async (id: string) => { try { await deleteQuestion(id, form.id); @@ -504,7 +519,7 @@ export default function FormEditorClient({ form, initialQuestions }: FormEditorC Question {index + 1} · {questionTypeLabel(q.type)} - {q.required ? " · Required" : ""} + {q.required || q.imageAnswerMode === "required" ? " · Required" : ""} @@ -639,29 +654,12 @@ export default function FormEditorClient({ form, initialQuestions }: FormEditorC /> )} -
- - handleUpdateQuestion(q.id, { required: checked }) - } - /> - -
- - Answer image + + Response type + + “Image only” hides the normal answer field. “Answer + required image” requires both. + + {(q.imageAnswerMode === "none" || q.imageAnswerMode === "optional") && ( + + + handleUpdateQuestion(q.id, { required: checked }) + } + /> +
+ + Require answer + + + Users must complete the normal answer field. + +
+
+ )} {(q.type === "radio" || q.type === "checkbox") && ( diff --git a/app/admin/form/[id]/result/[submissionId]/client.tsx b/app/admin/form/[id]/result/[submissionId]/client.tsx index 53f427a..d93fe66 100644 --- a/app/admin/form/[id]/result/[submissionId]/client.tsx +++ b/app/admin/form/[id]/result/[submissionId]/client.tsx @@ -157,15 +157,11 @@ export default function SubmissionDetailClient({ - Admin note - - Private context for administrators. Respondents cannot see this note. - + Note - Note