Skip to content

Generic form system: frontend dynamic grant form (PR 5/5) - #4711

Open
marcoacierno wants to merge 5 commits into
generic-forms/04-adminfrom
generic-forms/05-frontend
Open

Generic form system: frontend dynamic grant form (PR 5/5)#4711
marcoacierno wants to merge 5 commits into
generic-forms/04-adminfrom
generic-forms/05-frontend

Conversation

@marcoacierno

Copy link
Copy Markdown
Member

Summary

Final PR of the stack (stacked on #4709; parallel to #4710). The grant form renders its soft questions from the conference's generic form.

  • DynamicForm component (components/dynamic-form/): renders questions by type — text/url → Input, textarea → Textarea, select → Select (option ids/labels from the form), multi-select → checkbox group, boolean → checkbox — with required/maxLength hints and per-question server errors from the answersErrors map. Answers are an opaque {questionId: value} record.
  • Grant form: fetches conference.form(purpose: GRANT) alongside the deadline; the six dynamic inputs (ageGroup, pythonUsage, beenToOtherEvents, communityContribution, why, notes) are replaced by a card titled with the form's name; the mutation payload sends answers and no longer includes the legacy six. gender/occupation keep their structured selects (their columns feed the grants summary).
  • Null-form guard: without a configured GRANT form, submission is blocked with a "form not available" notice — the page never submits without answers.
  • Edit flow: prefills from me.grant.formAnswers; legacy soft-field + validation selections stripped from my-grant.graphql, update-grant.graphql, submit-grant.graphql.
  • Accepted, specced regression: dateBirth→ageGroup and profile-gender prefills for dynamic questions drop. AGE_GROUPS_OPTIONS removed (unused).

Verification

  • pnpm codegen + type-check green against the PR3 schema (local backend)
  • Biome clean on all touched files
  • Live SSR check: seeded a GRANT form (4 questions, all types) in local admin → /en/grants renders every question + option labels with zero code references to them (spec success criterion 6)
  • Full next build fails only at the static-export stage on unrelated pages (/404, /brochure) — verified pre-existing: the unmodified tree fails identically against the local env
  • Manual submit + edit flows in browser (no Chromium in my env — please eyeball)
  • Frontend has no test runner configured — plan's "component test" step impossible without adding one (out of scope per spec boundaries)

⚠️ Draft until

  1. Generic form system: grants backend integration (PR 3/5) #4709 merges and is deployed to staging (pastaporto)frontend-lint CI codegens against the staging schema and needs answers/answersErrors/formAnswers/Conference.form live there.
  2. Ops before merge: create the GRANT form (6 questions) in staging + production admin — seeding command was cut from scope. Cutover should land before grants open (pre-cutover applications show empty dynamic questions in edit).

Follow-up (ticketed, not in stack): two-step legacy-field removal — frontend-only selection strip → soak → backend input-field removal.

Stack: #4705#4707#4709 → (#4710this).

New DynamicForm component renders a form's questions by type (text,
textarea, select, multi-select, boolean, url) with per-question server
errors from the answersErrors map. The grant form fetches
conference.form(purpose: GRANT) alongside the deadline, replaces the
six hardcoded dynamic inputs (ageGroup, pythonUsage, beenToOtherEvents,
communityContribution, why, notes) with it and sends the answers map
instead of the legacy fields; gender and occupation keep their
structured selects. Without a configured form, submission is blocked
with a 'form not available' notice.

The edit flow prefills from me.grant.formAnswers; legacy soft-field
and validation selections are stripped from the grant documents. The
dateBirth->ageGroup prefill is dropped (accepted regression, specced).
@vercel

vercel Bot commented Aug 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pycon Error Error Aug 7, 2026 2:48am

@marcoacierno
marcoacierno marked this pull request as ready for review August 7, 2026 02:27
@marcoacierno
marcoacierno changed the base branch from generic-forms/03-grants-backend to generic-forms/04-admin August 7, 2026 02:28
@claude

claude Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Adds a DynamicForm component that renders grant-form questions from the conference's generic Form config (by type: text/url/textarea/select/multi-select/boolean), and rewires the grant form to fetch/submit through it instead of the six hardcoded soft fields.

A couple of minor gaps:

  • No client-side required validation for MultiSelect/Boolean questions. Input/Textarea/Select in dynamic-form/index.tsx pass required={question.required} through to the underlying field, but the MultiSelect and Boolean branches don't enforce/signal required at all — a required checkbox-group or boolean question can be submitted empty and only gets caught after the server round-trip via answersErrors. This is a step down from the previous per-field selects which all had native required.
  • Validation error display is inconsistent between question types. For Input/Textarea/Select, errors is passed into the field component itself (presumably wired into its error styling). For MultiSelect/Boolean, errors are rendered separately via a bare QuestionErrors text block that isn't integrated with the same visual treatment.
  • Orphaned locale strings. locale/index.ts still has entries under grants.form.fields.pythonUsage, communityContribution, beenToOtherEvents, why, notes, and grants.form.youAndPython (both en/it) that are no longer referenced anywhere now that those fields were removed from grant-form/index.tsx. Worth deleting as part of this cleanup rather than leaving them dead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant