Update UserProfileSettings.tsx
This commit is contained in:
parent
3bda85b7bc
commit
167d729334
1 changed files with 176 additions and 9 deletions
|
@ -2,9 +2,178 @@ import { useState, useEffect } from 'react';
|
|||
import { Authentication } from '../../../scripts/pocketbase/Authentication';
|
||||
import { Update } from '../../../scripts/pocketbase/Update';
|
||||
import { Collections, type User } from '../../../schemas/pocketbase/schema';
|
||||
import allMajors from '../../../data/allUCSDMajors.txt?raw';
|
||||
import { toast } from 'react-hot-toast';
|
||||
|
||||
// Define the majors directly in the component file to avoid import issues
|
||||
const UCSD_MAJORS = [
|
||||
"Astronomy & Astrophysics",
|
||||
"Anthropology",
|
||||
"Bioengineering",
|
||||
"Biology with Specialization in Bioinformatics",
|
||||
"Ecology, Behavior and Evolution",
|
||||
"General Biology",
|
||||
"Human Biology",
|
||||
"Microbiology",
|
||||
"Molecular and Cell Biology",
|
||||
"Neurobiology / Physiology and Neuroscience",
|
||||
"Biochemistry and Cell Biology",
|
||||
"Biochemistry",
|
||||
"Chemistry",
|
||||
"Environmental Chemistry",
|
||||
"Molecular Synthesis",
|
||||
"Pharmacological Chemistry",
|
||||
"Chinese Studies",
|
||||
"Cinematic Arts",
|
||||
"Classical Studies",
|
||||
"Cognitive Science",
|
||||
"Cognitive Science – Clinical Aspects of Cognition",
|
||||
"Cognitive Science – Design and Interaction",
|
||||
"Cognitive Science – Language and Culture",
|
||||
"Cognitive Science – Machine Learning and Neural Computation",
|
||||
"Cognitive Science – Neuroscience",
|
||||
"Cognitive and Behavioral Neuroscience",
|
||||
"Communication",
|
||||
"Media Industries and Communication",
|
||||
"Computer Engineering",
|
||||
"Computer Science",
|
||||
"Computer Science – Bioinformatics",
|
||||
"Critical Gender Studies",
|
||||
"Dance",
|
||||
"Data Science",
|
||||
"Business Economics",
|
||||
"Economics",
|
||||
"Economics and Mathematics – Joint Major",
|
||||
"Economics-Public Policy",
|
||||
"Education Sciences",
|
||||
"Electrical Engineering",
|
||||
"Electrical Engineering and Society",
|
||||
"Engineering Physics",
|
||||
"Environmental Systems (Earth Sciences)",
|
||||
"Environmental Systems (Ecology, Behavior & Evolution)",
|
||||
"Environmental Systems (Environmental Chemistry)",
|
||||
"Environmental Systems (Environmental Policy)",
|
||||
"Ethnic Studies",
|
||||
"German Studies",
|
||||
"Global Health",
|
||||
"Global South Studies",
|
||||
"Public Health",
|
||||
"Public Health – Biostatistics",
|
||||
"Public Health – Climate and Environmental Sciences",
|
||||
"Public Health – Community Health Sciences",
|
||||
"Public Health – Epidemiology",
|
||||
"Public Health – Health Policy and Management Sciences",
|
||||
"Public Health – Medicine Sciences",
|
||||
"History",
|
||||
"Human Developmental Sciences",
|
||||
"Human Developmental Sciences – Equity and Diversity",
|
||||
"Human Developmental Sciences – Healthy Aging",
|
||||
"International Studies – Anthropology",
|
||||
"International Studies – Economics",
|
||||
"International Studies – Economics (Joint BA/MIA)",
|
||||
"International Studies – History",
|
||||
"International Studies – International Business",
|
||||
"International Studies – International Business (Joint BA/MIA)",
|
||||
"International Studies – Linguistics",
|
||||
"International Studies – Literature",
|
||||
"International Studies – Philosophy",
|
||||
"International Studies – Political Science",
|
||||
"International Studies – Political Science (Joint BA/MIA)",
|
||||
"International Studies – Sociology",
|
||||
"Italian Studies",
|
||||
"Japanese Studies",
|
||||
"Jewish Studies",
|
||||
"Latin American Studies",
|
||||
"Latin American Studies – Mexico",
|
||||
"Latin American Studies – Migration and Border Studies",
|
||||
"Linguistics",
|
||||
"Linguistics – Cognition and Language",
|
||||
"Linguistics – Language and Society",
|
||||
"Linguistics: Language Studies",
|
||||
"Linguistics – Speech and Language Sciences",
|
||||
"Literary Arts",
|
||||
"Literatures in English",
|
||||
"Spanish Literature",
|
||||
"World Literature and Culture",
|
||||
"Mathematical Biology",
|
||||
"Mathematics (Applied)",
|
||||
"Mathematics",
|
||||
"Mathematics – Applied Science",
|
||||
"Mathematics – Computer Science",
|
||||
"Mathematics – Secondary Education",
|
||||
"Probability and Statistics",
|
||||
"Aerospace Engineering",
|
||||
"Aerospace Engineering – Aerothermodynamics",
|
||||
"Aerospace Engineering – Astrodynamics and Space Applications",
|
||||
"Aerospace Engineering – Flight Dynamics and Controls",
|
||||
"Mechanical Engineering",
|
||||
"Mechanical Engineering – Controls and Robotics",
|
||||
"Mechanical Engineering – Fluid Mechanics and Thermal Systems",
|
||||
"Mechanical Engineering – Materials Science and Engineering",
|
||||
"Mechanical Engineering – Mechanics of Materials",
|
||||
"Mechanical Engineering – Renewable Energy and Environmental Flows",
|
||||
"Music",
|
||||
"Music Humanities",
|
||||
"Interdisciplinary Computing and the Arts",
|
||||
"Chemical Engineering",
|
||||
"NanoEngineering",
|
||||
"Philosophy",
|
||||
"General Physics",
|
||||
"General Physics/Secondary Education",
|
||||
"Physics",
|
||||
"Physics – Astrophysics",
|
||||
"Physics – Biophysics",
|
||||
"Physics – Computational Physics",
|
||||
"Physics – Earth Sciences",
|
||||
"Physics – Materials Physics",
|
||||
"Political Science",
|
||||
"Political Science – American Politics",
|
||||
"Political Science – Comparative Politics",
|
||||
"Political Science – Data Analytics",
|
||||
"Political Science – International Affairs",
|
||||
"Political Science – International Relations",
|
||||
"Political Science – Political Theory",
|
||||
"Political Science – Public Law",
|
||||
"Political Science – Public Policy",
|
||||
"Political Science – Race, Ethnicity, and Politics",
|
||||
"Psychology",
|
||||
"Psychology – Clinical Psychology",
|
||||
"Psychology – Cognitive Psychology",
|
||||
"Psychology – Developmental Psychology",
|
||||
"Psychology – Human Health",
|
||||
"Psychology – Sensation and Perception",
|
||||
"Psychology – Social Psychology",
|
||||
"Business Psychology",
|
||||
"Study of Religion",
|
||||
"Russian, East European & Eurasian Studies",
|
||||
"Geosciences",
|
||||
"Marine Biology",
|
||||
"Oceanic and Atmospheric Sciences",
|
||||
"Sociology",
|
||||
"Sociology – International Studies",
|
||||
"Sociology – American Studies",
|
||||
"Sociology – Science and Medicine",
|
||||
"Sociology – Economy and Society",
|
||||
"Sociology – Culture and Communication",
|
||||
"Sociology – Social Inequality",
|
||||
"Sociology – Law and Society",
|
||||
"Structural Engineering",
|
||||
"Structural Engineering – Aerospace Structures",
|
||||
"Structural Engineering – Civil Structures",
|
||||
"Structural Engineering – Geotechnical Engineering",
|
||||
"Structural Engineering – Structural Health Monitoring/Non-Destructive Evaluation",
|
||||
"Theatre",
|
||||
"Undeclared – Humanities/Arts",
|
||||
"Undeclared – Physical Sciences",
|
||||
"Undeclared – Social Sciences",
|
||||
"Urban Studies and Planning",
|
||||
"Real Estate and Development",
|
||||
"Art History/Criticism",
|
||||
"Media",
|
||||
"Speculative Design",
|
||||
"Studio",
|
||||
"Other"
|
||||
].sort();
|
||||
|
||||
interface UserProfileSettingsProps {
|
||||
logtoApiEndpoint?: string;
|
||||
}
|
||||
|
@ -330,17 +499,15 @@ export default function UserProfileSettings({
|
|||
>
|
||||
<option value="">Select a major</option>
|
||||
{(() => {
|
||||
const standardMajors = allMajors
|
||||
.split('\n')
|
||||
.filter(major => major.trim() !== '')
|
||||
.sort((a, b) => a.localeCompare(b));
|
||||
// Create a list including both standard majors and the user's major if it's not in the list
|
||||
const displayMajors = [...UCSD_MAJORS];
|
||||
|
||||
if (formData.major && !standardMajors.includes(formData.major)) {
|
||||
standardMajors.push(formData.major);
|
||||
standardMajors.sort((a, b) => a.localeCompare(b));
|
||||
if (formData.major && !displayMajors.includes(formData.major)) {
|
||||
displayMajors.push(formData.major);
|
||||
displayMajors.sort((a, b) => a.localeCompare(b));
|
||||
}
|
||||
|
||||
return standardMajors.map((major, index) => (
|
||||
return displayMajors.map((major, index) => (
|
||||
<option key={index} value={major}>
|
||||
{major}
|
||||
</option>
|
||||
|
|
Loading…
Reference in a new issue