From 5354f899163fd00cda560828cf0368102b8c852b Mon Sep 17 00:00:00 2001 From: Christian Walker <76548772+christianhelp@users.noreply.github.com> Date: Sun, 11 Aug 2024 22:52:07 -0400 Subject: [PATCH] Fix registration blocking bug (#87) --- .../components/registration/RegisterForm.tsx | 19 ++++++++++--------- .../web/src/validators/shared/RegisterForm.ts | 1 + packages/config/hackkit.config.ts | 4 ++-- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/apps/web/src/components/registration/RegisterForm.tsx b/apps/web/src/components/registration/RegisterForm.tsx index 2c17e657..072dc3b2 100644 --- a/apps/web/src/components/registration/RegisterForm.tsx +++ b/apps/web/src/components/registration/RegisterForm.tsx @@ -94,6 +94,10 @@ export default function RegisterForm({ defaultEmail }: RegisterFormProps) { }, }); + const { isSubmitSuccessful, isSubmitted, errors } = form.formState; + + const hasErrors = !isSubmitSuccessful && isSubmitted; + const [uploadedFile, setUploadedFile] = useState(null); const [skills, setSkills] = useState([]); const [isLoading, setIsLoading] = useState(false); @@ -110,7 +114,6 @@ export default function RegisterForm({ defaultEmail }: RegisterFormProps) { async function onSubmit(data: z.infer) { setIsLoading(true); - console.log("Submision Clicked"); if (!userId || !isLoaded) { setIsLoading(false); return alert( @@ -179,10 +182,6 @@ export default function RegisterForm({ defaultEmail }: RegisterFormProps) { ); } if (acceptedFiles.length > 0) { - console.log( - `Got accepted file! The length of the array is ${acceptedFiles.length}.`, - ); - console.log(acceptedFiles[0]); setUploadedFile(acceptedFiles[0]); } }, @@ -552,10 +551,6 @@ export default function RegisterForm({ defaultEmail }: RegisterFormProps) { onSelect={( value, ) => { - console.log( - "value changed to: ", - value, - ); form.setValue( "university", value, @@ -1212,6 +1207,12 @@ export default function RegisterForm({ defaultEmail }: RegisterFormProps) { /> + {hasErrors && ( +

+ Something doesn't look right. Please check your + inputs. +

+ )} diff --git a/apps/web/src/validators/shared/RegisterForm.ts b/apps/web/src/validators/shared/RegisterForm.ts index d6afb01a..ba46b28f 100644 --- a/apps/web/src/validators/shared/RegisterForm.ts +++ b/apps/web/src/validators/shared/RegisterForm.ts @@ -80,6 +80,7 @@ export const RegisterFormValidator = z.object({ z.literal("Sophomore", defaultPrettyError), z.literal("Junior", defaultPrettyError), z.literal("Senior", defaultPrettyError), + z.literal("Recent Grad", defaultPrettyError), z.literal("Other", defaultPrettyError), ]), hackathonsAttended: z diff --git a/packages/config/hackkit.config.ts b/packages/config/hackkit.config.ts index 3480540d..2301f708 100644 --- a/packages/config/hackkit.config.ts +++ b/packages/config/hackkit.config.ts @@ -592,6 +592,8 @@ export const schools = [ ] as const; export const majors = [ + "Computer Science", + "Cyber Security", "Accounting", "Accounting Technician", "Actuarial Science", @@ -625,13 +627,11 @@ export const majors = [ "Computer & Information Sciences, General", "Computer Engineering", "Computer Networking/Telecommunications", - "Computer Science", "Computer Software & Media Applications", "Computer System Administration", "Construction Engineering/Management", "Creative Writing", "Criminology", - "Cyber Security", "Data Management Technology", "Dental Assisting", "Design & Visual Communications, General",