Skip to content

Commit

Permalink
Merge pull request #1701 from acm-ucr/1463-country-names
Browse files Browse the repository at this point in the history
Add country selection to meet MLH conditions for participant signups
  • Loading branch information
shahdivyank authored Aug 9, 2024
2 parents d650713 + 34aba4c commit 9a949a8
Show file tree
Hide file tree
Showing 8 changed files with 235 additions and 1 deletion.
10 changes: 10 additions & 0 deletions cypress/fixtures/participants.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"phone": "000-000-0000",
"discord": "john_smith",
"age": "18",
"country": "United States of America",
"school": "University of California - Riverside",
"grade": "junior",
"gender": "Female",
Expand All @@ -27,6 +28,7 @@
"phone": "000-000-0000",
"discord": "john_smith",
"age": "20",
"country": "United States of America",
"school": "University of California - Riverside",
"grade": "junior",
"gender": "Male",
Expand All @@ -46,6 +48,7 @@
"phone": "000-000-0000",
"discord": "john_smith",
"age": "22",
"country": "United States of America",
"school": "University of California - Irvine",
"grade": "junior",
"gender": "Other",
Expand All @@ -65,6 +68,7 @@
"phone": "000-000-0000",
"discord": "john_smith",
"age": "22",
"country": "United States of America",
"school": "University of California - Irvine",
"grade": "junior",
"gender": "Other",
Expand All @@ -84,6 +88,7 @@
"phone": "000-000-0000",
"discord": "john_smith",
"age": "22",
"country": "United States of America",
"school": "University of California - Irvine",
"grade": "junior",
"gender": "Other",
Expand All @@ -103,6 +108,7 @@
"phone": "000-000-0000",
"discord": "john_smith",
"age": "22",
"country": "United States of America",
"school": "University of California - Irvine",
"grade": "junior",
"gender": "Other",
Expand All @@ -122,6 +128,7 @@
"phone": "000-000-0000",
"discord": "john_smith",
"age": "22",
"country": "United States of America",
"school": "University of California - Irvine",
"grade": "junior",
"gender": "Other",
Expand All @@ -141,6 +148,7 @@
"phone": "000-000-0000",
"discord": "john_smith",
"age": "22",
"country": "United States of America",
"school": "University of California - Irvine",
"grade": "junior",
"gender": "Other",
Expand All @@ -160,6 +168,7 @@
"phone": "000-000-0000",
"discord": "john_smith",
"age": "22",
"country": "United States of America",
"school": "University of California - Irvine",
"grade": "junior",
"gender": "Other",
Expand All @@ -179,6 +188,7 @@
"phone": "000-000-0000",
"discord": "john_smith",
"age": "22",
"country": "United States of America",
"school": "University of California - Irvine",
"grade": "junior",
"gender": "Other",
Expand Down
3 changes: 2 additions & 1 deletion src/app/api/participant/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ export const POST = async (req) => {
{ status: auth },
);
}
const { phone, major, age, school, grade, gender, shirt, diet } =
const { phone, major, age, country, school, grade, gender, shirt, diet } =
await req.json();

try {
await updateDoc(doc(db, "users", user.id), {
phone: phone,
major: major,
age: age,
country: country,
school: school,
grade: grade,
gender: gender,
Expand Down
9 changes: 9 additions & 0 deletions src/components/user/User.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
SHIRTS,
} from "@/data/form/Information";
import { SCHOOLS } from "@/data/form/Schools";
import { COUNTRIES } from "@/data/form/Country";
import Input from "../Input";
import Radio from "../Radio";
import Select from "../Select";
Expand Down Expand Up @@ -61,6 +62,14 @@ const User = ({ user, setUser, edit, setEdit }) => {
setUser={setUser}
editable={edit}
/>
<Select
title="Country"
items={COUNTRIES}
field="country"
user={user}
setUser={setUser}
editable={edit}
/>
<Select
title="Major"
items={MAJORS}
Expand Down
1 change: 1 addition & 0 deletions src/data/admin/Dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export const ATTRIBUTES: attributes = {
"phone",
"major",
"age",
"country",
"school",
"grade",
"gender",
Expand Down
2 changes: 2 additions & 0 deletions src/data/admin/Icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
Mail,
Shirt,
Calendar,
MapPin,
} from "lucide-react";

import {
Expand Down Expand Up @@ -38,6 +39,7 @@ export const ICONS: Record<string, JSX.Element> = {
grade: <School className="mr-2 text-lg text-hackathon-blue-200" />,
major: <BookOpen className="mr-2 text-lg text-hackathon-blue-200" />,
school: <School className="mr-2 text-lg text-hackathon-blue-200" />,
country: <MapPin className="mr-2 text-lg text-hackathon-blue-200" />,
eventSource: <Calendar className="mr-2 text-lg text-hackathon-blue-200" />,
priorHackathons: <Clock className="mr-2 text-lg text-hackathon-blue-200" />,
};
1 change: 1 addition & 0 deletions src/data/admin/Participants.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ const attributes = [
"phone",
"age",
"gender",
"country",
"school",
"major",
"grade",
Expand Down
198 changes: 198 additions & 0 deletions src/data/form/Countries.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
type countries = string[];
export const COUNTRIES: countries = [
"Afghanistan",
"Albania",
"Algeria",
"Andorra",
"Angola",
"Antigua and Barbuda",
"Argentina",
"Armenia",
"Australia",
"Austria",
"Azerbaijan",
"Bahamas",
"Bahrain",
"Bangladesh",
"Barbados",
"Belarus",
"Belgium",
"Belize",
"Benin",
"Bhutan",
"Bolivia",
"Bosnia and Herzegovina",
"Botswana",
"Brazil",
"Brunei",
"Bulgaria",
"Burkina Faso",
"Burundi",
"Cabo Verde",
"Cambodia",
"Cameroon",
"Canada",
"Central African Republic",
"Chad",
"Chile",
"China",
"Colombia",
"Comoros",
"Congo",
"Costa Rica",
"Croatia",
"Cuba",
"Cyprus",
"Czech Republic",
"Democratic Republic of the Congo",
"Denmark",
"Djibouti",
"Dominica",
"Dominican Republic",
"East Timor (Timor-Leste)",
"Ecuador",
"Egypt",
"El Salvador",
"Equatorial Guinea",
"Eritrea",
"Estonia",
"Eswatini",
"Ethiopia",
"Fiji",
"Finland",
"France",
"Gabon",
"Gambia",
"Georgia",
"Germany",
"Ghana",
"Greece",
"Grenada",
"Guatemala",
"Guinea",
"Guinea-Bissau",
"Guyana",
"Haiti",
"Honduras",
"Hungary",
"Iceland",
"India",
"Indonesia",
"Iran",
"Iraq",
"Ireland",
"Israel",
"Italy",
"Jamaica",
"Japan",
"Jordan",
"Kazakhstan",
"Kenya",
"Kiribati",
"North Korea",
"South Korea",
"Kosovo",
"Kuwait",
"Kyrgyzstan",
"Laos",
"Latvia",
"Lebanon",
"Lesotho",
"Liberia",
"Libya",
"Liechtenstein",
"Lithuania",
"Luxembourg",
"Madagascar",
"Malawi",
"Malaysia",
"Maldives",
"Mali",
"Malta",
"Marshall Islands",
"Mauritania",
"Mauritius",
"Mexico",
"Micronesia",
"Moldova",
"Monaco",
"Mongolia",
"Montenegro",
"Morocco",
"Mozambique",
"Myanmar (Burma)",
"Namibia",
"Nauru",
"Nepal",
"Netherlands",
"New Zealand",
"Nicaragua",
"Niger",
"Nigeria",
"North Macedonia",
"Norway",
"Oman",
"Pakistan",
"Palau",
"Palestine",
"Panama",
"Papua New Guinea",
"Paraguay",
"Peru",
"Philippines",
"Poland",
"Portugal",
"Qatar",
"Romania",
"Russia",
"Rwanda",
"Saint Kitts and Nevis",
"Saint Lucia",
"Saint Vincent and the Grenadines",
"Samoa",
"San Marino",
"Sao Tome and Principe",
"Saudi Arabia",
"Senegal",
"Serbia",
"Seychelles",
"Sierra Leone",
"Singapore",
"Slovakia",
"Slovenia",
"Solomon Islands",
"Somalia",
"South Africa",
"South Sudan",
"Spain",
"Sri Lanka",
"Sudan",
"Suriname",
"Sweden",
"Switzerland",
"Syria",
"Tajikistan",
"Tanzania",
"Thailand",
"Togo",
"Tonga",
"Trinidad and Tobago",
"Tunisia",
"Turkey",
"Turkmenistan",
"Tuvalu",
"Uganda",
"Ukraine",
"United Arab Emirates",
"United Kingdom",
"United States of America",
"Uruguay",
"Uzbekistan",
"Vanuatu",
"Vatican City (Holy See)",
"Venezuela",
"Vietnam",
"Yemen",
"Zambia",
"Zimbabwe",
];
12 changes: 12 additions & 0 deletions src/data/form/Participant.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { GENDERS } from "./Information";
import { SHIRTS } from "./Information";
import { SCHOOLS } from "./Schools";
import data from "@/data/Config";
import { COUNTRIES } from "./Countries";

export const FIELDS = {
description: {
Expand Down Expand Up @@ -84,6 +85,16 @@ export const FIELDS = {
required: true,
searchable: true,
},
country: {
input: "select",
title: "Country",
options: COUNTRIES,
field: "country",
placeholder: "ie. United States of America",
width: 12,
required: true,
searchable: true,
},
school: {
input: "select",
title: "School",
Expand Down Expand Up @@ -163,6 +174,7 @@ export const ATTRIBUTES = {
phone: "",
major: "",
age: "",
country: "",
school: "",
grade: "",
gender: "",
Expand Down

0 comments on commit 9a949a8

Please sign in to comment.