Skip to content

Commit

Permalink
Fix registration blocking bug
Browse files Browse the repository at this point in the history
  • Loading branch information
christianhelp committed Aug 12, 2024
1 parent b9e145e commit 28969a9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
25 changes: 16 additions & 9 deletions apps/web/src/components/registration/RegisterForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,22 @@ export default function RegisterForm({ defaultEmail }: RegisterFormProps) {
},
});

const { isSubmitSuccessful, isSubmitted, errors} = form.formState;

const hasErrors = !isSubmitSuccessful && isSubmitted;

useEffect(() => {
console.log("errors are", errors);
},[errors]);


const [uploadedFile, setUploadedFile] = useState<File | null>(null);
const [skills, setSkills] = useState<Tag[]>([]);
const [isLoading, setIsLoading] = useState(false);
const universityValue = form.watch("university");
const bioValue = form.watch("bio");

// wtf is this
useEffect(() => {
if (universityValue != c.localUniversityName.toLowerCase()) {
form.setValue("shortID", "NOT_LOCAL_SCHOOL");
Expand All @@ -110,7 +120,6 @@ export default function RegisterForm({ defaultEmail }: RegisterFormProps) {

async function onSubmit(data: z.infer<typeof RegisterFormValidator>) {
setIsLoading(true);
console.log("Submision Clicked");
if (!userId || !isLoaded) {
setIsLoading(false);
return alert(
Expand Down Expand Up @@ -179,10 +188,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]);
}
},
Expand Down Expand Up @@ -552,10 +557,7 @@ export default function RegisterForm({ defaultEmail }: RegisterFormProps) {
onSelect={(
value,
) => {
console.log(
"value changed to: ",
value,
);

form.setValue(
"university",
value,
Expand Down Expand Up @@ -1212,6 +1214,11 @@ export default function RegisterForm({ defaultEmail }: RegisterFormProps) {
/>
</FormGroupWrapper>
<Button type="submit">Submit</Button>
{
hasErrors && (
<p className="text-red-800">Something doesn't look right. Please check your inputs.</p>
)
}
</form>
</Form>
</div>
Expand Down
1 change: 1 addition & 0 deletions apps/web/src/validators/shared/RegisterForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions packages/config/hackkit.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,8 @@ export const schools = [
] as const;

export const majors = [
"Computer Science",
"Cyber Security",
"Accounting",
"Accounting Technician",
"Actuarial Science",
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 28969a9

Please sign in to comment.