Skip to content

Commit 743007c

Browse files
authored
Merge pull request #83 from UTDNebula/package-updates
Package updates
2 parents d487541 + bbfbbd9 commit 743007c

21 files changed

+6448
-4599
lines changed

next-env.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
/// <reference types="next/image-types/global" />
33

44
// NOTE: This file should not be edited
5-
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.
5+
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

package-lock.json

Lines changed: 6265 additions & 4470 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,38 +17,38 @@
1717
"lint:check": "next lint"
1818
},
1919
"dependencies": {
20-
"@emotion/react": "^11.13.3",
21-
"@emotion/styled": "^11.13.0",
22-
"@mui/icons-material": "^5.16.7",
23-
"@mui/material": "^5.15.5",
24-
"@plasmohq/messaging": "^0.6.2",
25-
"@plasmohq/storage": "^1.12.0",
20+
"@emotion/react": "^11.14.0",
21+
"@emotion/styled": "^11.14.0",
22+
"@mui/icons-material": "^5.17.1",
23+
"@mui/material": "^5.17.1",
24+
"@plasmohq/messaging": "^0.7.1",
25+
"@plasmohq/storage": "^1.15.0",
2626
"@types/firefox-webext-browser": "^120.0.4",
27-
"apexcharts": "^4.2.0",
28-
"next": "^14.2.15",
29-
"plasmo": "^0.89.3",
30-
"react": "^18.3.1",
27+
"apexcharts": "^4.7.0",
28+
"next": "^15.3.1",
29+
"plasmo": "^0.90.3",
30+
"react": "^19.1.0",
3131
"react-apexcharts": "^1.7.0",
32-
"react-dom": "^18.3.1"
32+
"react-dom": "^19.1.0"
3333
},
3434
"devDependencies": {
35-
"@types/chrome": "^0.0.277",
36-
"@types/node": "^22.7.5",
37-
"@types/react": "^18.3.11",
38-
"@types/react-dom": "^18.3.0",
39-
"@typescript-eslint/eslint-plugin": "^8.8.1",
40-
"autoprefixer": "^10.4.20",
41-
"eslint": "^8.57.1",
42-
"eslint-config-next": "^14.2.15",
43-
"eslint-config-prettier": "^9.0.0",
44-
"eslint-plugin-jsx-a11y": "^6.10.0",
45-
"eslint-plugin-react": "^7.37.1",
46-
"eslint-plugin-react-hooks": "^4.6.2",
35+
"@types/chrome": "^0.0.318",
36+
"@types/node": "^22.15.3",
37+
"@types/react": "^19.1.2",
38+
"@types/react-dom": "^19.1.3",
39+
"@typescript-eslint/eslint-plugin": "^8.31.1",
40+
"autoprefixer": "^10.4.21",
41+
"eslint": "^9.26.0",
42+
"eslint-config-next": "^15.3.1",
43+
"eslint-config-prettier": "^10.1.2",
44+
"eslint-plugin-jsx-a11y": "^6.10.2",
45+
"eslint-plugin-react": "^7.37.5",
46+
"eslint-plugin-react-hooks": "^5.2.0",
4747
"eslint-plugin-simple-import-sort": "^12.1.1",
48-
"postcss": "^8.4.47",
49-
"prettier": "^3.3.3",
50-
"tailwindcss": "^3.4.13",
51-
"typescript": "^5.6.3"
48+
"postcss": "^8.5.3",
49+
"prettier": "^3.5.3",
50+
"tailwindcss": "^3.4.17",
51+
"typescript": "^5.8.3"
5252
},
5353
"eslintConfig": {
5454
"root": true,
Lines changed: 18 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -13,43 +13,14 @@ import fetchWithCache, {
1313
cacheIndexGrades,
1414
expireTime,
1515
} from '~data/fetchWithCache';
16+
import type { GenericFetchedData } from '~types/GenericFetchedData';
17+
import type { GradesData, GradesType } from '~types/GradesType';
1618
import {
1719
convertToProfOnly,
1820
type SearchQuery,
1921
searchQueryEqual,
2022
searchQueryLabel,
21-
} from '~utils/SearchQuery';
22-
23-
type GenericFetchedDataError<T> = {
24-
state: 'error';
25-
data?: T;
26-
};
27-
type GenericFetchedDataLoading = {
28-
state: 'loading';
29-
};
30-
type GenericFetchedDataDone<T> = {
31-
state: 'done';
32-
data: T;
33-
};
34-
export type GenericFetchedData<T> =
35-
| GenericFetchedDataError<T>
36-
| GenericFetchedDataLoading
37-
| GenericFetchedDataDone<T>;
38-
39-
const gpaToLetterGrade = (gpa: number): string => {
40-
if (gpa >= 4.0) return 'A';
41-
if (gpa >= 3.67) return 'A-';
42-
if (gpa >= 3.33) return 'B+';
43-
if (gpa >= 3.0) return 'B';
44-
if (gpa >= 2.67) return 'B-';
45-
if (gpa >= 2.33) return 'C+';
46-
if (gpa >= 2.0) return 'C';
47-
if (gpa >= 1.67) return 'C-';
48-
if (gpa >= 1.33) return 'D+';
49-
if (gpa >= 1.0) return 'D';
50-
if (gpa >= 0.67) return 'D-';
51-
return 'F';
52-
};
23+
} from '~types/SearchQuery';
5324

5425
//Find GPA, total, and grade_distribution based on including some set of semesters
5526
function calculateGrades(grades: GradesData, academicSessions?: string[]) {
@@ -73,36 +44,35 @@ function calculateGrades(grades: GradesData, academicSessions?: string[]) {
7344
const GPALookup = [
7445
4, 4, 3.67, 3.33, 3, 2.67, 2.33, 2, 1.67, 1.33, 1, 0.67, 0,
7546
];
76-
let gpa = -1;
47+
let mean_gpa = -1;
7748
if (total !== 0) {
78-
gpa =
49+
mean_gpa =
7950
GPALookup.reduce(
8051
(accumulator, currentValue, index) =>
8152
accumulator + currentValue * grade_distribution[index],
8253
0,
8354
) /
8455
(total - grade_distribution[grade_distribution.length - 1]);
8556
}
86-
const letter_grade = gpaToLetterGrade(gpa);
57+
58+
let median_gpa = -1;
59+
let medianIndex = -1;
60+
if (total != 0) {
61+
let i = Math.floor(total / 2);
62+
while (i > 0) {
63+
medianIndex++;
64+
i -= grade_distribution[medianIndex];
65+
}
66+
median_gpa = GPALookup[medianIndex];
67+
}
8768

8869
return {
89-
gpa: gpa,
70+
mean_gpa: mean_gpa,
71+
gpa: median_gpa,
9072
total: total,
9173
grade_distribution: grade_distribution,
92-
letter_grade: letter_grade,
9374
};
9475
}
95-
type GradesData = {
96-
_id: string;
97-
grade_distribution: number[];
98-
}[];
99-
export type GradesType = {
100-
gpa: number;
101-
total: number;
102-
grade_distribution: number[];
103-
letter_grade: string;
104-
grades: GradesData;
105-
};
10676
//Fetch grades by academic session from nebula api
10777
function fetchGradesData(course: SearchQuery): Promise<GradesType> {
10878
return fetchWithCache(

src/background/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
scrapeCourseData,
77
} from '~content';
88
import { neededOrigins } from '~data/config';
9-
import { type SearchQuery } from '~utils/SearchQuery';
9+
import { type SearchQuery } from '~types/SearchQuery';
1010

1111
export interface ShowCourseTabPayload {
1212
header: string | SearchQuery;

src/components/CourseOverview.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ import { Skeleton } from '@mui/material';
22
import React from 'react';
33

44
import { TRENDS_URL } from '~data/config';
5-
import type { GenericFetchedData, GradesType } from '~pages';
6-
import { type SearchQuery, searchQueryLabel } from '~utils/SearchQuery';
5+
import type { GenericFetchedData } from '~types/GenericFetchedData';
6+
import type { GradesType } from '~types/GradesType';
7+
import { type SearchQuery, searchQueryLabel } from '~types/SearchQuery';
8+
import gpaToLetterGrade from '~utils/gpaToLetterGrade';
79

810
type CourseOverviewProps = {
911
header: string | SearchQuery;
@@ -26,7 +28,7 @@ const CourseOverview = ({ header, grades }: CourseOverviewProps) => {
2628
)) ||
2729
(grades.state === 'done' && (
2830
<p className="text-lg font-semibold">
29-
{'Overall grade: ' + grades.data.letter_grade}
31+
{'Overall grade: ' + gpaToLetterGrade(grades.data.gpa)}
3032
</p>
3133
))}
3234
<a

src/components/Landing.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ const Landing = () => {
130130
variant="contained"
131131
disableElevation
132132
size="large"
133-
className="normal-case bg-royal hover:bg-royalDark"
133+
className="normal-case"
134134
onClick={() => storage.set(STORAGE_KEY, 1)}
135135
>
136136
Get Started

src/components/ProfessorOverview.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ import fetchWithCache, {
1010
cacheIndexProfessor,
1111
expireTime,
1212
} from '~data/fetchWithCache';
13-
import type { GenericFetchedData, GradesType } from '~pages';
14-
import { type SearchQuery, searchQueryLabel } from '~utils/SearchQuery';
13+
import type { GenericFetchedData } from '~types/GenericFetchedData';
14+
import type { GradesType } from '~types/GradesType';
15+
import { type SearchQuery, searchQueryLabel } from '~types/SearchQuery';
1516

1617
const fallbackSrc = 'https://profiles.utdallas.edu/img/default.png';
1718

src/components/Rating.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { Rating as _Rating, styled } from '@mui/material';
1+
import { Rating, styled } from '@mui/material';
22

33
// for star color for rating
4-
const Rating = styled(_Rating)(({ theme }) => ({
4+
const StyledRating = styled(Rating)(({ theme }) => ({
55
'& .MuiRating-iconFilled': {
66
color: theme.palette.primary.main,
77
},
88
}));
99

10-
export default Rating;
10+
export default StyledRating;

src/components/SearchResultsTable.tsx

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,16 @@ import SingleGradesInfo from '~components/SingleGradesInfo';
2222
import SingleProfInfo from '~components/SingleProfInfo';
2323
import TableSortLabel from '~components/TableSortLabel';
2424
import type { RMPInterface } from '~data/fetchFromRmp';
25-
import type { GenericFetchedData, GradesType } from '~pages';
26-
import { useRainbowColors } from '~utils/colors';
25+
import type { GenericFetchedData } from '~types/GenericFetchedData';
26+
import type { GradesType } from '~types/GradesType';
2727
import {
2828
convertToCourseOnly,
2929
convertToProfOnly,
3030
type SearchQuery,
3131
searchQueryLabel,
32-
} from '~utils/SearchQuery';
32+
} from '~types/SearchQuery';
33+
import { useRainbowColors } from '~utils/colors';
34+
import gpaToLetterGrade from '~utils/gpaToLetterGrade';
3335

3436
type RowProps = {
3537
course: SearchQuery;
@@ -160,7 +162,12 @@ function Row({
160162
)) ||
161163
(backupGrades.state === 'done' && (
162164
<Tooltip
163-
title={'GPA: ' + backupGrades.data.gpa.toFixed(2)}
165+
title={
166+
'Median GPA: ' +
167+
backupGrades.data.gpa.toFixed(2) +
168+
' | Mean GPA: ' +
169+
backupGrades.data.mean_gpa.toFixed(2)
170+
}
164171
placement="top"
165172
>
166173
<Badge
@@ -189,7 +196,7 @@ function Row({
189196
backgroundColor: gpaToColor(backupGrades.data.gpa),
190197
}}
191198
>
192-
{backupGrades.data.letter_grade}
199+
{gpaToLetterGrade(backupGrades.data.gpa)}
193200
</Typography>
194201
</Badge>
195202
</Tooltip>
@@ -204,14 +211,19 @@ function Row({
204211
)) ||
205212
(grades.state === 'done' && (
206213
<Tooltip
207-
title={'GPA: ' + grades.data.gpa.toFixed(2)}
214+
title={
215+
'Median GPA: ' +
216+
grades.data.gpa.toFixed(2) +
217+
' | Mean GPA: ' +
218+
grades.data.mean_gpa.toFixed(2)
219+
}
208220
placement="top"
209221
>
210222
<Typography
211223
className="text-base text-black text-center rounded-full px-5 py-2 w-16 block mx-auto"
212224
sx={{ backgroundColor: gpaToColor(grades.data.gpa) }}
213225
>
214-
{grades.data.letter_grade}
226+
{gpaToLetterGrade(grades.data.gpa)}
215227
</Typography>
216228
</Tooltip>
217229
)) ||
@@ -362,7 +374,7 @@ const SearchResultsTable = ({
362374
<TableCell>Actions</TableCell>
363375
<TableCell>
364376
<Tooltip
365-
title="Average GPA Across Course Sections"
377+
title="Median GPA Across Course Sections"
366378
placement="top"
367379
>
368380
<div>

0 commit comments

Comments
 (0)