Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
a868f63
backend for RMP database
GiangNPham Mar 18, 2025
3c2d9ab
frontend to render RMP data
GiangNPham Mar 26, 2025
fbbf78d
fix bug: data not changing between sections + N/A before RMP data ful…
GiangNPham Mar 26, 2025
c7f9729
feat: added grade distribution for Summer 2024 (#66)
emw8105 Mar 8, 2025
4019e6e
Update to actions/cache@v3 (#68)
FarhanJamil0001 Mar 8, 2025
dc3fe28
feat: added grade distribution for Fall 2024 (#67)
emw8105 Mar 8, 2025
7189b78
testing different layout of RMP info
FarhanJamil0001 Mar 26, 2025
206dedd
changing the professor details container
FarhanJamil0001 Mar 26, 2025
d086229
changing the professor details container and style
FarhanJamil0001 Mar 26, 2025
9804454
fix build issues with removing suggested courses section
FarhanJamil0001 Mar 26, 2025
635c9dc
fix bug: name not matched
GiangNPham Mar 27, 2025
bead8de
wokring on UI changes
FarhanJamil0001 Mar 27, 2025
7b4a961
RMP data design updated on SectionContent component
FarhanJamil0001 Mar 28, 2025
ba760f2
RMP data design updated on SectionContent component
FarhanJamil0001 Mar 28, 2025
a3b3719
added color to RMPScore and Difficulty
FarhanJamil0001 Mar 28, 2025
db46c27
updated builtwithlove
FarhanJamil0001 Mar 28, 2025
c8b188e
updated tooltip styling
jor-dango Mar 28, 2025
441ff6a
modified tooltip styling slightly
jor-dango Mar 28, 2025
67d8b18
Removed extraneous code
jor-dango Mar 28, 2025
cae6363
fixed small build isues
FarhanJamil0001 Mar 28, 2025
3c9d6b4
fixed small build isues
FarhanJamil0001 Mar 28, 2025
5ffa1c0
fix bug: some of the courses may not be found so cannot render the in…
GiangNPham Mar 28, 2025
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 .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- run: npm install

# Cache Next output (see https://nextjs.org/docs/messages/no-cache#github-actions)
- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: |
~/.npm
Expand Down
Binary file added client/public/rmp-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 16 additions & 4 deletions client/src/components/Core.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,16 @@ const TrendsText = styled.p`
margin-bottom: 0;
`;

const BuiltWithLove = styled.p`
display: flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
font-size: 1.2rem;
margin: 0.5rem 0;
font-weight: 550;
`;

const NebulaLogo = styled.img`
height: 1.375rem;
filter: drop-shadow(0 0 4px rgb(0 0 0 / 0.6));
Expand Down Expand Up @@ -90,11 +100,10 @@ function Core({ children }: CoreProps) {
<NebulaLogo src="/nebula-logo.svg" />
<TrendsText>Compare everything in one place with <b>UTD Trends</b></TrendsText>
</TrendsLink>
<p>
<BuiltWithLove>
Built with <HeartTwoTone twoToneColor="#eb2f96" /> by{" "}
<a href="https://www.acmutd.co" target={"blank"}>ACM Dev</a>. Raw data available{" "}
<a href="https://github.com/acmutd/utd-grades/tree/master/raw_data" target={"blank"}>for download</a>.
</p>
<a href="https://www.acmutd.co" target={"blank"}>ACM Dev</a>
</BuiltWithLove>
<p>
Designed by <a href="https://www.arimilli.io" target={"blank"}>Bharat Arimilli</a>. Thanks to{" "}
<a href="https://garrettgu.com/" target={"blank"}>Garrett Gu</a>,{" "}
Expand All @@ -103,6 +112,9 @@ function Core({ children }: CoreProps) {
<Popover content={donors}>
<span style={{ textDecoration: "underline" }}>donors</span>.
</Popover>

<a href="https://github.com/acmutd/utd-grades/tree/master/raw_data" target={"blank"}> Raw data available for download</a>

</p>
</Footer>
</Container>
Expand Down
60 changes: 59 additions & 1 deletion client/src/components/SearchResults.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import type { RMPInstructor } from "@utd-grades/db";
import { Col, Row } from "antd";
import type { NextRouter } from "next/router";
import React, { useEffect, useRef } from "react";
import React, { useEffect, useRef, useState } from "react";
import { useQuery } from "react-query";
import { animateScroll as scroll } from "react-scroll";
import styled from "styled-components";
import type { SearchQuery } from "../types";
import { normalizeName } from "../utils/index";
import { useDb } from "../utils/useDb";
import Search from "./Search";
import SearchResultsContent from "./SearchResultsContent";
Expand Down Expand Up @@ -53,6 +55,7 @@ export default function Results({ search, sectionId, router }: ResultsProps) {

const { data: db } = useDb();

// this is to get all of the other sections of the same class (for the side bar)
const {
data: sections,
status: sectionsStatus,
Expand All @@ -64,6 +67,7 @@ export default function Results({ search, sectionId, router }: ResultsProps) {
{ enabled: !!db }
);

// get the section data
const {
data: section,
status: sectionStatus,
Expand All @@ -90,6 +94,58 @@ export default function Results({ search, sectionId, router }: ResultsProps) {
{ enabled: !!section }
);

// some professors have the same name so we need to get the whole list
const normalName: string[] = normalizeName(
`${section?.instructor1?.first} ${section?.instructor1?.last}`
);

const { data: instructors } = useQuery<RMPInstructor[]>(
["instructors", sectionId],
async () => {
const results = await Promise.all(normalName.map((name) => db!.getInstructorsByName(name)));
return results.flat();
},
{ enabled: !!section }
);

// from that list, we need to find the one that holds the session -> update the instructor and course rating
const [instructor, setInstructor] = useState<RMPInstructor>();
const [courseRating, setCourseRating] = useState<number | null>(null);

useEffect(() => {
if (instructors && section) {
// when there is only professor that matches the needed name -> set the instructor to that prof
// this helps prevent that some of the courses may not be listed in the RMP data but we still want to the prof data

// however, if there're 2 profs with the same name and the course we're looking for is not listed in either instructor's RMP courses
// then we don't know who to return
// this will not be a problem when the new RMP data is updated
if (instructors.length === 1) {
setInstructor(instructors[0]);
const rating = db!.getCourseRating(
instructors[0]!.instructor_id,
`${section.subject}${section.catalogNumber}`
);
setCourseRating(rating);
} else {
for (const ins of instructors) {
const rating = db!.getCourseRating(
ins.instructor_id,
`${section.subject}${section.catalogNumber}`
);
if (rating) {
setInstructor(ins);
setCourseRating(rating);
break;
}
}
}
} else {
setInstructor(undefined);
setCourseRating(null);
}
}, [instructors, section, db]);

useEffect(() => {
// Automatically select section if there is only one choice
if (sections && sections.length == 1) {
Expand Down Expand Up @@ -158,6 +214,8 @@ export default function Results({ search, sectionId, router }: ResultsProps) {
<SearchResultsContent
section={section!} // FIXME: need to actually do something if these are null
relatedSections={relatedSections!}
instructor={instructor!}
courseRating={courseRating}
loadingSection={sectionStatus === "loading"}
handleRelatedSectionClick={handleRelatedSectionClick}
error={sectionError}
Expand Down
16 changes: 11 additions & 5 deletions client/src/components/SearchResultsContent.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Grades } from "@utd-grades/db";
import type { Grades, RMPInstructor } from "@utd-grades/db";
import { Spin } from "antd";
import React from "react";
import styled from "styled-components";
Expand Down Expand Up @@ -27,6 +27,8 @@ const Spinner = styled(Spin)`

interface SearchResultsContentProps {
section: Grades;
instructor: RMPInstructor;
courseRating: number | null;
relatedSections: Grades[];
loadingSection: boolean;
handleRelatedSectionClick: (search: string, id: number) => void;
Expand All @@ -35,17 +37,21 @@ interface SearchResultsContentProps {

export default function SearchResultsContent({
section,
relatedSections,
instructor,
courseRating,
// relatedSections,
loadingSection,
handleRelatedSectionClick,
// handleRelatedSectionClick,
error,
}: SearchResultsContentProps) {
if (section) {
return (
<SectionContent
section={section}
relatedSections={relatedSections}
handleRelatedSectionClick={handleRelatedSectionClick}
instructor={instructor}
courseRating={courseRating}
// relatedSections={relatedSections}
// handleRelatedSectionClick={handleRelatedSectionClick}
/>
);
} else if (loadingSection) {
Expand Down
Loading