feat: add view responses page
Docker Build and Push / build-and-push (push) Has been cancelled

This commit is contained in:
2026-02-22 19:03:35 +07:00
parent 4014ec802a
commit 218e8d10a0
8 changed files with 1076 additions and 7 deletions
-6
View File
@@ -32,7 +32,6 @@ export default function SubmitFormPage() {
try {
const data = await getFormById(id!)
setForm(data)
// Initialize empty answers
const initial: Record<string, string> = {}
data.questions.forEach((q) => {
initial[q.id] = ""
@@ -53,7 +52,6 @@ export default function SubmitFormPage() {
function updateAnswer(questionId: string, value: string) {
setAnswers((prev) => ({ ...prev, [questionId]: value }))
// Clear validation error on change
if (validationErrors[questionId]) {
setValidationErrors((prev) => {
const next = { ...prev }
@@ -82,7 +80,6 @@ export default function SubmitFormPage() {
if (!id || !form) return
if (!validate()) {
// Scroll to first error
const firstErrorId = form.questions.find((q) => validationErrors[q.id] || (q.required && !answers[q.id]?.trim()))?.id
if (firstErrorId) {
document.getElementById(`question-${firstErrorId}`)?.scrollIntoView({ behavior: "smooth", block: "center" })
@@ -161,7 +158,6 @@ export default function SubmitFormPage() {
size="sm"
onClick={() => {
setSubmitted(false)
// Reset answers
if (form) {
const initial: Record<string, string> = {}
form.questions.forEach((q) => { initial[q.id] = "" })
@@ -270,8 +266,6 @@ export default function SubmitFormPage() {
)
}
// ─── Question field component ────────────────────────────────────────────────
interface QuestionFieldProps {
question: Question
index: number