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

feat: add UCLA support #54

Merged
merged 3 commits into from
Apr 5, 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 components/search/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ const Search = () => {
const fetchData = async () => {
try {
const universityParam = university;
const geParam = !ge.includes("GE") ? ge : ge.split(" ")[1];
const geParam = ge.includes("GE") ? ge.split(" ")[1] : ge;
const courses = await queryDatabase(universityParam, geParam);

setCourses(courses);
Expand Down
13 changes: 12 additions & 1 deletion components/search/SearchResults.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,18 @@ const SearchResults = (props: SearchResultsProps) => {
</div>
<div className="flex flex-row gap-2 text-base font-light">
{result.fulfillsGEs
.map((obj) => obj.category)
.map((obj) => {
const category =
obj.category;

return category.includes(
":",
)
? category.split(
": ",
)[1]
: category;
})
.join(", ")}
</div>
</div>
Expand Down
30 changes: 22 additions & 8 deletions components/search/SearchSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,31 @@ export const SearchSelect = (props: DropdownComponentProps) => {
return (
<div className="relative flex h-12 w-[300px] md:h-16">
<Select value={value} onValueChange={onChange}>
<SelectTrigger className="h-full w-full overflow-ellipsis rounded-xl border-2 border-gray px-4 text-base md:text-2xl">
<SelectTrigger className="h-full w-full overflow-ellipsis rounded-xl border-2 border-gray px-4 text-left text-base md:text-2xl">
<SelectValue placeholder={placeholder} />
</SelectTrigger>
<SelectContent>
{data.map((item) => (
<SelectItem value={item} key={item} className="text-lg">
{item.includes("University of California")
? "UC " + item.split(", ")[1]
: item}
</SelectItem>
))}
{data.map((item) => {
let option = item;

if (option.includes("University of California")) {
option = "UC " + item.split(", ")[1];
}

if (option.includes(": ")) {
option = item.split(": ")[1];
}

return (
<SelectItem
value={item}
key={item}
className="text-lg"
>
{option}
</SelectItem>
);
})}
</SelectContent>
</Select>
</div>
Expand Down
9 changes: 9 additions & 0 deletions lib/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,13 @@ export const UNIVERSITY_GE: Record<string, string[]> = {
"GE F",
"GE G",
],
"University of California, Los Angeles": [
"Arts and Humanities: Literary and Cultural Analysis",
"Arts and Humanities: Philosophical and Linguistic Analysis",
"Arts and Humanities: Visual and Performance Arts Analysis and Practice",
"Scientific Inquiry: Life Sciences",
"Scientific Inquiry: Physical Sciences",
"Society and Culture: Historical Analysis",
"Society and Culture: Social Analysis",
],
};
Loading