Skip to content

Commit

Permalink
Revert "revert changes"
Browse files Browse the repository at this point in the history
This reverts commit 5e172dc.
  • Loading branch information
nishikar12 committed Apr 11, 2024
1 parent dc121f1 commit cdd1685
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ jobs:
npm install
npm install -g eslint
- name: Run ESLint
run: eslint . --ext .js,.jsx,.ts,.tsx --max-warnings 0
run: eslint . --ext .js,.jsx,.ts,.tsx --max-warnings 0
4 changes: 2 additions & 2 deletions lib/components/popups/course-search/prereqs/PrereqDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ const PrereqDisplay: FC = () => {
setHasPreReqs(false);

// First get all valid preReqs (isNegative = true)
let preReqs = filterNNegatives(courseToShow);
let preReqs = filterNNegatives(version);
setNNegativePreReqs(preReqs);
// If there exists preReqs, we need to process and display them.
if (version !== 'None' && preReqs.length > 0) {
setHasPreReqs(true);
display(preReqs);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [courseToShow]);
}, [version, courseCache]);

/**
* Processes then displays prereqs.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ const PrereqDropdown: FC<{
const getChildPrereqs = () => {
// eslint-disable-next-line array-callback-return
return element.map((el: any, index: number): JSX.Element => {
return processPrereqs(el, index);
if (typeof el === 'number') {
return processPrereqs(el, index);
} else return <></>;
});
};

Expand Down
6 changes: 1 addition & 5 deletions lib/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@

body {
margin: 0;
font-family:
Futura,
Trebuchet MS,
Arial,
sans-serif;
font-family: Futura, Trebuchet MS, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
Expand Down
27 changes: 3 additions & 24 deletions lib/resources/assets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -276,11 +276,9 @@ export const course_tags = [
* @param inspected - the course
* @returns array with valid prereqs
*/
export const filterNNegatives = (
inspected: UserCourse | Course | 'None' | null,
): any[] => {
export const filterNNegatives = (inspected: Course | 'None'): any[] => {
let preReqs: any[] = [];
if (inspected !== 'None' && inspected) {
if (inspected !== 'None' && inspected !== undefined) {
preReqs = inspected.preReq.filter((section: any) => {
return section.IsNegative === 'N';
});
Expand Down Expand Up @@ -1033,8 +1031,7 @@ export const checkAllPrereqs = (
return new Promise((resolve) => {
getCourse(number, courseCache, currCourses, -1).then((course) => {
if (course.resp !== null) {
const version = getVersion(course.resp, semester + ' ' + year.year);
let filtered = filterNNegatives(version);
let filtered = filterNNegatives(course.resp);
if (filtered.length === 0) {
return resolve(true);
} else {
Expand Down Expand Up @@ -1064,24 +1061,6 @@ export const checkAllPrereqs = (
});
};

/**
* @param course - course object
* @param term - term of the course
* @returns the version of course with matching term
*/
export const getVersion = (course: any, term: string) => {
for (let v of course.versions) {
if (v.term === term) {
return v;
}
}
if (course.versions.length > 0) {
return course.versions[0];
} else {
return course;
}
};

/**
* @param major - major name
* @returns the major object from the name
Expand Down
4 changes: 1 addition & 3 deletions lib/resources/redux_sample/Counter.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@
left: 0;
top: 0;
opacity: 0;
transition:
width 1s linear,
opacity 0.5s ease 1s;
transition: width 1s linear, opacity 0.5s ease 1s;
}

.asyncButton:active:after {
Expand Down

0 comments on commit cdd1685

Please sign in to comment.