From c6980784e12ab9ea0bf257c2da7f9cac80fee89f Mon Sep 17 00:00:00 2001 From: FinleyNeilson Date: Tue, 21 Jul 2026 21:14:08 +1200 Subject: [PATCH 1/2] feat(registration): cap faculty selection and replace other faculty with majors --- src/app/registration/_pages/NewUoaPage.tsx | 63 ++++++------- src/app/registration/_tests/actions.test.ts | 92 +++++++++++++------ src/app/registration/actions.ts | 79 ++++++++-------- src/app/registration/types.ts | 3 +- src/domain/member/_tests/validation.test.ts | 3 + src/domain/member/constants.ts | 1 + .../parseRegistrationFormData.test.ts | 5 + .../parseRegistrationFormData.ts | 2 + 8 files changed, 148 insertions(+), 100 deletions(-) diff --git a/src/app/registration/_pages/NewUoaPage.tsx b/src/app/registration/_pages/NewUoaPage.tsx index bc4603b..4be9c6d 100644 --- a/src/app/registration/_pages/NewUoaPage.tsx +++ b/src/app/registration/_pages/NewUoaPage.tsx @@ -2,18 +2,14 @@ import { useFormError } from "../RegistrationForm"; import { RegistrationDraft } from "../types"; - -import { useRef } from "react"; +import { MAX_MAJORS } from "@/domain/member/constants"; export function NewUoaPage({ fields }: { fields: Partial }) { const state = useFormError(); const errorFields = state?.fields; const field = errorFields ?? fields; - /* Client JS enhancement: - * Used to create a reference to the Other checkbox so it automatically checks when user enters text - */ - const otherFacultyCheckboxRef = useRef(null); + const majorCount = Math.min(field?.majorCount ?? 1, MAX_MAJORS); return ( <> @@ -136,41 +132,36 @@ export function NewUoaPage({ fields }: { fields: Partial }) { /> Auckland Bioengineering Institute + + -