Los triggers 1.1, 1.6, 1.13 muestran solo Sí · No (sin "Prefiero no decir")

Al responder "No" en las tres, el formulario salta a 6.4 (no muestra secciones 2-5 ni 6.1-6.3)
La pregunta 6.6 aparece antes del cierre
Las preguntas multiple_choice muestran el hint "Podés marcar más de una opción"
This commit is contained in:
markosbenitez
2026-06-10 15:49:05 -03:00
parent bf963e8894
commit 157e108322
15 changed files with 1096 additions and 161 deletions

View File

@@ -2,7 +2,7 @@
import { useCallback, useEffect, useRef, useState, useTransition } from 'react'
import type { FormAnswers, Question, Survey } from '@/lib/types'
import { clearDraft, loadDraft, saveDraft } from '@/lib/storage'
import { getHiddenCodes, isQuestionVisible } from '@/lib/conditional'
import { getHiddenCodes, isQuestionVisible, ruleQuestionCodes } from '@/lib/conditional'
import { submitSurvey } from '@/app/actions/submit-survey'
import { ConsentScreen } from './consent-screen'
import { ProgressBar } from './progress-bar'
@@ -71,7 +71,7 @@ export function SurveyForm({ survey, questions }: SurveyFormProps) {
} else {
const appeared = questions.some(
(q) =>
q.conditional_rules?.some((r) => r.if_question === code) &&
q.conditional_rules?.some((r) => ruleQuestionCodes(r).includes(code)) &&
isQuestionVisible(q, updated) &&
!isQuestionVisible(q, prev)
)

View File

@@ -40,11 +40,13 @@ export function CheckboxGroup({
{required && <span className="required-mark" aria-hidden="true"> *</span>}
{required && <span className="sr-only"> (obligatorio)</span>}
</legend>
{maxSelect !== null && (
{maxSelect !== null ? (
<p className="max-select-hint" aria-live="polite">
Elegí hasta {maxSelect} opciones
{value.length > 0 && ` · ${value.length}/${maxSelect} seleccionadas`}
</p>
) : (
<p className="max-select-hint">Podés marcar más de una opción</p>
)}
<div className="options-list" role="list">
{options.map((opt) => {