feat: Create member registration form structure and flow #39
feat: Create member registration form structure and flow #39FinleyNeilson wants to merge 16 commits into
Conversation
add form pages with information from original member registration form add branching logic for each page depending on user selections
also start refactor for client side checking
- Add RegistrationForm file that was accidently left out of previous commit - Rename 'form' directory to 'registration'
WilliamTayNZ
left a comment
There was a problem hiding this comment.
Good first prototype, form workflow generally works
WilliamTayNZ
left a comment
There was a problem hiding this comment.
There were mistakes in the original schema, so some field names/values will need to change when i share the new one, e.g. skill/involvement will be linuxSkillLevel/potentialInvolvement.
| defaultValue={state?.fields?.email || ""} // This is what prevents the clearing | ||
| className={`border p-2 w-full ${state?.error?.includes("email") ? "border-red-500" : "border-gray-300"}`} | ||
| /> | ||
| {state?.error?.includes("email") && ( |
There was a problem hiding this comment.
Seems like no other page in pages handles errors right now? I think you can just put a generic error message in RegistrationForm for now, so errors at any step will be visible
- Sync field names and radio/checkbox values with new Prisma Enums (LinuxSkillLevel, PotentialInvolvement, YearLevel). - Implement generic error handling in RegistrationForm - Improve accessibility by replacing generic <div>/ <p> structures with semantic <fieldset>, <legend>, and properly linked <label> tags. - Remove redundant hidden "page" inputs from individual page components. - Update UI components to use <textarea> for longer inputs.
Good improvements!
|
Server action: suggested changes
Right now First, we should define the possible form pages: type RegistrationPage =
| "start"
| "returningUoa"
| "newMember"
| "newUoa"
| "newNonUoa" // change this from "newOther", the page name asw
| "final";Then the cookie draft state could look like this: type RegistrationDraft = {
page: RegistrationPage;
// Start page
email?: string;
isConditionalReturningMember?: string;
// New member page
firstName?: string;
lastName?: string;
isCurrentUoaStudent?: string;
// Returning/current UoA fields
upi?: string;
studentId?: string;
// Current UoA only
faculty?: string[];
programme?: string;
yearLevel?: string;
// Non-UoA only
primaryAffiliation?: string;
nonUoaExcerpt?: string;
nonUoaPitch?: string;
// Final page
linuxSkillLevel?: string;
potentialInvolvement?: string[];
discordUsername?: string;
};This is separate from the final validated domain type. It's just the partially completed multi-step form state that lets us preserve answers between steps and submit the full form at the end. The type RegistrationFormState = {
error?: string;
fields?: Partial<RegistrationDraft>;
} | null
|
Cookie implementationFor the cookie state, the main purpose is to preserve the user’s draft between steps, supporting back/forward navigation, and making sure the final submit has all the data from earlier steps. The current approach is close, but we shouldn't use Instead, at each step, collect fields explicitly using We should also safely parse the cookie with Also, with Ideal flow: I also think we should implement the back-navigation now, because it'll make it much easier to verify that the cookie draft state is actually being saved and restored correctly |
This PR establishes the technical foundation for the LUG@UoA registration process. It focuses on the underlying Server Action architecture and the creation of the page skeletons that mirror the original Google Form flow.
Closes #37
Closes #38