Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: MLH form fields and resume are optional, change form persist key for DH11 #201

Merged
merged 4 commits into from
Oct 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/FormDivider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ interface FormDividerProps {

const FormDivider: React.FC<FormDividerProps> = ({ label }) => {
return (
<span className="my-4 border-b-2 border-neutral-700 pb-2 text-xl font-semibold text-neutral-900 dark:text-neutral-400">
<span className="my-4 border-b-2 border-neutral-700 dark:border-neutral-300 pb-2 text-xl font-semibold text-neutral-900 dark:text-neutral-100">
{label}
</span>
);
Expand Down
102 changes: 57 additions & 45 deletions src/pages/apply.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ const ApplyForm = ({
},
});

useFormPersist(`applyForm:${persistId}`, {
useFormPersist(`dh11-applyForm:${persistId}`, {
watch,
setValue,
storage: localStorage,
Expand All @@ -196,7 +196,6 @@ const ApplyForm = ({
console.log(data);
console.log("validating");
const processed = applicationSchema.parse(data);

console.log("validated");

await submitAppAsync(processed);
Expand Down Expand Up @@ -569,13 +568,54 @@ const ApplyForm = ({
<span className="text-error">{errors.discoverdFrom.message}</span>
)}
</div>

<FormCheckbox
label="Do you already have a team?"
id="alreadyHaveTeam"
errors={errors.alreadyHaveTeam}
register={register}
/>
<FormCheckbox
label="Would you like to be considered for a coffee chat with a sponsor?"
id="considerCoffee"
errors={errors.considerCoffee}
register={register}
/>
Krish120003 marked this conversation as resolved.
Show resolved Hide resolved
<FormDivider label="Emergency Contact" />
<div className="flex flex-col md:flex-row md:items-end md:gap-4">
<FormInput
label="Name of Emergency Contact"
id="emergencyContactName"
errors={errors.emergencyContactName}
placeholder="James Doe"
register={register}
/>
<FormInput
label="Relation to Emergency Contact"
id="emergencyContactRelation"
errors={errors.emergencyContactRelation}
placeholder="Parent / Guardian / Friend / Spouse"
register={register}
/>
</div>
<FormInput
id="emergencyContactPhone"
label="Emergency Contact Phone Number"
errors={errors.emergencyContactPhone}
placeholder="000-000-0000"
register={register}
/>
<FormDivider label="MLH Survey and Consent" />
<div className="flex flex-col gap-2 pb-4">
<label
className="text-black dark:text-white"
htmlFor="underrepresentedInput"
>
Do you identify as part of an underrepresented group in the technology
industry?
industry?{" "}
<span className="text-neutral-500 dark:text-neutral-400">
(Optional)
</span>
</label>

<Controller
Expand All @@ -591,13 +631,16 @@ const ApplyForm = ({
)}
/>

{errors.gender && (
<span className="text-error">{errors.gender.message}</span>
{errors.underrepresented && (
<span className="text-error">{errors.underrepresented.message}</span>
)}
</div>
<div className="flex flex-col gap-2 pb-4">
<label className="text-black dark:text-white" htmlFor="genderInput">
Gender
What&apos;s your gender?{" "}
<span className="text-neutral-500 dark:text-neutral-400">
(Optional)
</span>
</label>

<Controller
Expand All @@ -622,7 +665,10 @@ const ApplyForm = ({
className="text-black dark:text-white"
htmlFor="orientationInput"
>
Orientation
Do you consider yourself to be any of the following?{" "}
<span className="text-neutral-500 dark:text-neutral-400">
(Optional)
</span>
</label>

<Controller
Expand All @@ -644,7 +690,10 @@ const ApplyForm = ({
</div>
<div className="flex flex-col gap-2 pb-4">
<label className="text-black dark:text-white" htmlFor="raceInput">
Race
Which ethnic background do you identify with?{" "}
<span className="text-neutral-500 dark:text-neutral-400">
(Optional)
</span>
</label>

<Controller
Expand All @@ -663,43 +712,6 @@ const ApplyForm = ({
<span className="text-error">{errors.race.message}</span>
)}
</div>
<FormCheckbox
label="Do you already have a team?"
id="alreadyHaveTeam"
errors={errors.alreadyHaveTeam}
register={register}
/>
<FormCheckbox
label="Would you like to be considered for a coffee chat with a sponsor?"
id="considerCoffee"
errors={errors.considerCoffee}
register={register}
/>
<FormDivider label="Emergency Contact" />
<div className="flex flex-col md:flex-row md:items-end md:gap-4">
<FormInput
label="Name of Emergency Contact"
id="emergencyContactName"
errors={errors.emergencyContactName}
placeholder="James Doe"
register={register}
/>
<FormInput
label="Relation to Emergency Contact"
id="emergencyContactRelation"
errors={errors.emergencyContactName}
placeholder="Parent / Guardian / Friend / Spouse"
register={register}
/>
</div>
<FormInput
id="emergencyContactPhone"
label="Emergency Contact Phone Number"
errors={errors.emergencyContactPhone}
placeholder="000-000-0000"
register={register}
/>
<FormDivider label="MLH Consent" />
<FormCheckbox
label="Agree to MLH Code of Conduct"
id="agreeToMLHCodeOfConduct"
Expand Down
12 changes: 6 additions & 6 deletions src/schemas/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const dh10schema = z.object({
"Transgender",
"Prefer not to say",
]),
race: z.string().min(1).max(255),
race: z.string().min(1).max(255).default("Prefer not to say"),
emergencyContactName: z.string().min(1),
emergencyContactPhone: z
.string()
Expand Down Expand Up @@ -180,7 +180,7 @@ const dh11schema = z.object({
})
.transform((string) => (!!string ? string : null))
.nullish(),
linkToResume: z.string().url().nullable(),
linkToResume: z.string().nullish(),
Krish120003 marked this conversation as resolved.
Show resolved Hide resolved
tshirtSize: z.enum(["XS", "S", "M", "L", "XL"]),
hackerKind: z.array(z.string()).min(1, "At least one selection is required"),
alreadyHaveTeam: z.boolean(),
Expand All @@ -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.default("UNSURE"),
gender: z.string().default("Prefer not to say"),
race: z.string().default("Prefer not to say"),
orientation: z.string().default("Prefer not to say"),
emergencyContactName: z.string().min(1, "This field is required"),
emergencyContactPhone: z
.string()
Expand Down
Loading