diff --git a/src/components/features/factotum/add-members.tsx b/src/components/features/factotum/add-members.tsx index 61562c4..f3ea94c 100644 --- a/src/components/features/factotum/add-members.tsx +++ b/src/components/features/factotum/add-members.tsx @@ -10,9 +10,13 @@ import { toast } from "sonner"; export default function AddMembers() { const [emails, setEmails] = useState(""); const server = useFactotum().server; - const [selectedRoles, setSelectedRoles] = useState(["mentor"]); + const [selectedRoles, setSelectedRoles] = useState(["hacker"]); const availableRoles = [ + { + label: "Hacker", + value: "hacker", + }, { label: "Mentor", value: "mentor", @@ -40,7 +44,7 @@ export default function AddMembers() { .split("\n") .map((e) => e.trim()) .filter((e) => e.length > 0); - + if (emailList.length === 0 || selectedRoles.length === 0) { toast.error("You must select at least one role and provide at least one email"); return; diff --git a/src/components/features/hackerapp/hacker-app-question.tsx b/src/components/features/hackerapp/hacker-app-question.tsx index e857d05..cfc7614 100644 --- a/src/components/features/hackerapp/hacker-app-question.tsx +++ b/src/components/features/hackerapp/hacker-app-question.tsx @@ -66,6 +66,7 @@ const FORM_INPUT_OPTIONS: HackerApplicationQuestionFormInputField[] = [ "race", "jobPosition", "connectPlus", + "travellingToHackathon", ]; export const SHOW_FORM_INPUT: HackerApplicationQuestionType[] = [ diff --git a/src/lib/firebase/types.ts b/src/lib/firebase/types.ts index b25fc36..f0fa08f 100644 --- a/src/lib/firebase/types.ts +++ b/src/lib/firebase/types.ts @@ -175,6 +175,7 @@ export interface Applicant { gender: string | Record; graduation: number; isOfLegalAge: boolean; + ageByHackathon: string; location: string; // city major: ApplicantMajor | Record; phoneNumber: string; // "+1 XXX-XXX-XXXX" @@ -318,7 +319,8 @@ export type HackerApplicationQuestionFormInputField = | "pronouns" | "race" | "jobPosition" - | "connectPlus"; + | "connectPlus" + | "travellingToHackathon"; export interface HackerApplicationQuestion { _id?: string; // internal title?: string; diff --git a/src/services/query.ts b/src/services/query.ts index 6fb2931..854d261 100644 --- a/src/services/query.ts +++ b/src/services/query.ts @@ -34,6 +34,15 @@ export const flattenApplicantData = (applicant: Applicant, hackathon?: string): const hackathonYear = year ? Number.parseInt(year) : 2025; const isLegacyFormat = hackathonYear < 2024 || hackathon === "nwHacks2024"; + const computedIsOfLegalAge = (applicant: Applicant) => { + const rawAge = applicant.basicInfo?.ageByHackathon + if (rawAge == "<=16") return false + if (rawAge == ">24") return true + + const numericAge = typeof rawAge === "number" ? rawAge : Number(rawAge) + return numericAge >= 19 + } + const flattened: FlattenedApplicant = { // Basic Info firstName: applicant.basicInfo?.legalFirstName || applicant.basicInfo?.firstName || "", @@ -55,7 +64,7 @@ export const flattenApplicantData = (applicant: Applicant, hackathon?: string): applicant.basicInfo?.gender as Record | undefined, '' ), - isOfLegalAge: applicant.basicInfo?.isOfLegalAge || false, + isOfLegalAge: computedIsOfLegalAge(applicant), culturalBackground: returnTrueKey(applicant.basicInfo?.ethnicity || applicant.basicInfo?.culturalBackground), dietaryRestriction: createStringFromSelection( applicant.basicInfo?.dietaryRestriction, @@ -148,6 +157,7 @@ export const getAvailableColumns = (): string[] => { gender: "", location: "", isOfLegalAge: true, + ageByHackathon: "0", ethnicity: { asian: false, black: false,