From d0ca5f7dc57b2f78da6a132055366beeef2b307a Mon Sep 17 00:00:00 2001 From: Tyler Hill Date: Tue, 3 Dec 2024 12:13:52 -0600 Subject: [PATCH] Fix loading jumping --- src/components/CourseOverview.tsx | 22 ++++++++++++-------- src/components/SearchResultsTable.tsx | 18 ++++++++--------- src/components/SingleProfInfo.tsx | 29 ++++++++++++++++----------- 3 files changed, 40 insertions(+), 29 deletions(-) diff --git a/src/components/CourseOverview.tsx b/src/components/CourseOverview.tsx index 34b99aa..b06f149 100644 --- a/src/components/CourseOverview.tsx +++ b/src/components/CourseOverview.tsx @@ -1,3 +1,4 @@ +import { Skeleton } from '@mui/material'; import React from 'react'; import { TRENDS_URL } from '~data/config'; @@ -11,15 +12,20 @@ type CourseOverviewProps = { const CourseOverview = ({ course, grades }: CourseOverviewProps) => { return ( -
-

+

+

{searchQueryLabel(course)}

- {grades.state === 'done' && ( -

- {'Overall grade: ' + grades.data.letter_grade} -

- )} + {(grades.state === 'loading' && ( + +

Overall grade: A+

+
+ )) || + (grades.state === 'done' && ( +

+ {'Overall grade: ' + grades.data.letter_grade} +

+ ))} { encodeURIComponent(searchQueryLabel(course)) } target="_blank" - className="underline text-blue-600 hover:text-blue-800 visited:text-purple-600 text-center" + className="underline text-blue-600 hover:text-blue-800 visited:text-purple-600" rel="noreferrer" > See on Trends diff --git a/src/components/SearchResultsTable.tsx b/src/components/SearchResultsTable.tsx index 1b40772..be7a060 100644 --- a/src/components/SearchResultsTable.tsx +++ b/src/components/SearchResultsTable.tsx @@ -117,16 +117,16 @@ function Row({ course, grades, backupGrades, rmp, setPage }: RowProps) { - + {((typeof grades === 'undefined' || grades.state === 'error') && (((typeof backupGrades === 'undefined' || backupGrades.state === 'error') && <>) || (backupGrades.state === 'loading' && ( - A + A+ )) || (backupGrades.state === 'done' && ( @@ -155,7 +155,7 @@ function Row({ course, grades, backupGrades, rmp, setPage }: RowProps) { } > - A + A+ )) || (grades.state === 'done' && ( @@ -179,7 +179,7 @@ function Row({ course, grades, backupGrades, rmp, setPage }: RowProps) { placement="top" > {grades.data.letter_grade} @@ -188,10 +188,10 @@ function Row({ course, grades, backupGrades, rmp, setPage }: RowProps) { )) || null} - + {((typeof rmp === 'undefined' || rmp.state === 'error') && <>) || (rmp.state === 'loading' && ( - + )) || diff --git a/src/components/SingleProfInfo.tsx b/src/components/SingleProfInfo.tsx index b6eef84..414a9cb 100644 --- a/src/components/SingleProfInfo.tsx +++ b/src/components/SingleProfInfo.tsx @@ -16,29 +16,34 @@ function SingleProfInfo({ rmp }: Props) { return ( -

- -

+ +

5.0

+

Professor rating

-

- -

+ +

5.0

+

Difficulty

-

- -

+ +

1,000

+

Ratings given

-

- -

+ +

99%

+

Would take again

+ + +

Visit Rate My Professors

+
+
); }