Skip to content

Commit

Permalink
fix landing random course
Browse files Browse the repository at this point in the history
  • Loading branch information
srikavin committed May 6, 2024
1 parent bcff076 commit 678d423
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions frontend/src/screens/LandingPageScreen/LandingPageScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {useState} from "react";
import {useMemo} from "react";
import {
ChatIcon,
CodeIcon,
Expand All @@ -12,6 +12,7 @@ import {
import {useTitle} from "../../util/useTitle";
import {HistoryScreen} from "../HistoryScreen/HistoryScreen";
import {NavLink} from "react-router-dom";
import {useSemesterContext} from "@/frontend/src/context/SemesterContext";

function NotificationInfo(props: { icon: any, title: string, description: string }) {
return (
Expand All @@ -29,18 +30,17 @@ function NotificationInfo(props: { icon: any, title: string, description: string
);
}

const randomCourseNames = [
'CMSC131-0101',
'CHEM131-1241',
'CMSC430-0101',
'CMSC330-0302',
'MATH410-0601',
'MATH410-0501',
'PHYS103-0801'
]

export function LandingPageScreen() {
const [randomCourseName, _] = useState(randomCourseNames[Math.floor(Math.random() * randomCourseNames.length)]);
const {courseListing} = useSemesterContext();

const randomCourseName = useMemo(() => {
if (courseListing.length === 0) {
return "EMPTY";
}
let filteredCourseListings = courseListing.filter(x => x.includes('-'));

return filteredCourseListings[Math.floor(Math.random() * filteredCourseListings.length)];
}, [courseListing])

useTitle("Waitlist Watcher");

Expand Down

0 comments on commit 678d423

Please sign in to comment.