From 415a862aa68bb966bb4ed1cc0e66894cec146184 Mon Sep 17 00:00:00 2001 From: Krish120003 Date: Sat, 19 Oct 2024 15:23:12 -0400 Subject: [PATCH 1/4] feat: update form persist id --- src/pages/apply.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/apply.tsx b/src/pages/apply.tsx index a3d5089e..dff13426 100644 --- a/src/pages/apply.tsx +++ b/src/pages/apply.tsx @@ -186,7 +186,7 @@ const ApplyForm = ({ }, }); - useFormPersist(`applyForm:${persistId}`, { + useFormPersist(`dh11-applyForm:${persistId}`, { watch, setValue, storage: localStorage, From 364c7b6995b185fbb15743504a23f9a57eb772b0 Mon Sep 17 00:00:00 2001 From: Krish120003 Date: Sat, 19 Oct 2024 15:57:40 -0400 Subject: [PATCH 2/4] fix: optional fields, separate out MLH survey --- src/components/FormDivider.tsx | 2 +- src/pages/apply.tsx | 100 ++++++++++++++++++--------------- src/schemas/application.ts | 12 ++-- 3 files changed, 63 insertions(+), 51 deletions(-) diff --git a/src/components/FormDivider.tsx b/src/components/FormDivider.tsx index 0a458bc1..dec6354e 100644 --- a/src/components/FormDivider.tsx +++ b/src/components/FormDivider.tsx @@ -4,7 +4,7 @@ interface FormDividerProps { const FormDivider: React.FC = ({ label }) => { return ( - + {label} ); diff --git a/src/pages/apply.tsx b/src/pages/apply.tsx index dff13426..ff19b4fc 100644 --- a/src/pages/apply.tsx +++ b/src/pages/apply.tsx @@ -196,7 +196,6 @@ const ApplyForm = ({ console.log(data); console.log("validating"); const processed = applicationSchema.parse(data); - console.log("validated"); await submitAppAsync(processed); @@ -569,13 +568,54 @@ const ApplyForm = ({ {errors.discoverdFrom.message} )} + + + + +
+ + +
+ +
- {errors.gender && ( - {errors.gender.message} + {errors.underrepresented && ( + {errors.underrepresented.message} )}
- Orientation + Do you consider yourself to be any of the following?{" "} + + (Optional) +
{errors.race.message} )}
- - - -
- - -
- - (!!string ? string : null)) .nullish(), - linkToResume: z.string().url().nullable(), + linkToResume: z.string().nullish(), tshirtSize: z.enum(["XS", "S", "M", "L", "XL"]), hackerKind: z.array(z.string()).min(1, "At least one selection is required"), alreadyHaveTeam: z.boolean(), @@ -190,10 +190,10 @@ const dh11schema = z.object({ .min(1, "At least one selection is required"), considerCoffee: z.boolean(), dietaryRestrictions: z.string().nullish(), - underrepresented: YesNoUnsure, - gender: z.string(), - race: z.string(), - orientation: z.string(), + underrepresented: YesNoUnsure.nullish().default("UNSURE"), + gender: z.string().nullish().default("Prefer not to say"), + race: z.string().nullish().default("Prefer not to say"), + orientation: z.string().nullish().default("Prefer not to say"), emergencyContactName: z.string().min(1, "This field is required"), emergencyContactPhone: z .string() From 64039cb174e2f5c146bdcb6764054f11882ace98 Mon Sep 17 00:00:00 2001 From: Krish120003 Date: Sat, 19 Oct 2024 16:16:50 -0400 Subject: [PATCH 3/4] fix: TS errors --- src/pages/apply.tsx | 2 +- src/schemas/application.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pages/apply.tsx b/src/pages/apply.tsx index ff19b4fc..5e1c5462 100644 --- a/src/pages/apply.tsx +++ b/src/pages/apply.tsx @@ -637,7 +637,7 @@ const ApplyForm = ({