From 9f2ad55cdec3e5eca993334e087e65d3955abe88 Mon Sep 17 00:00:00 2001
From: Tyler Hill
Date: Tue, 3 Dec 2024 12:28:44 -0600
Subject: [PATCH] Display RMP tags
---
src/components/SearchResultsTable.tsx | 30 ++++++++++++---
src/components/SingleProfInfo.tsx | 55 ++++++++++++++++++++++++++-
2 files changed, 77 insertions(+), 8 deletions(-)
diff --git a/src/components/SearchResultsTable.tsx b/src/components/SearchResultsTable.tsx
index 1b40772..a77a3f7 100644
--- a/src/components/SearchResultsTable.tsx
+++ b/src/components/SearchResultsTable.tsx
@@ -72,14 +72,32 @@ function Row({ course, grades, backupGrades, rmp, setPage }: RowProps) {
className="cursor-pointer"
>
- e.stopPropagation() // prevents opening/closing the card when clicking on the text
+ 0
+ ? 'Tags: ' +
+ rmp.data.teacherRatingTags
+ .sort((a, b) => b.tagCount - a.tagCount)
+ .slice(0, 3)
+ .map((tag) => tag.tagName)
+ .join(', ')
+ : 'No Tags Available')
}
- className="leading-tight text-lg text-gray-600 dark:text-gray-200"
+ placement="top"
>
- {searchQueryLabel(convertToProfOnly(course))}
-
+ e.stopPropagation() // prevents opening/closing the card when clicking on the text
+ }
+ className="leading-tight text-lg text-gray-600 dark:text-gray-200 cursor-text w-fit"
+ >
+ {searchQueryLabel(convertToProfOnly(course))}
+
+
@@ -42,6 +46,13 @@ function SingleProfInfo({ rmp }: Props) {
);
}
+
+ const topTags = rmp.data.teacherRatingTags.sort(
+ (a, b) => b.tagCount - a.tagCount,
+ );
+ const first5 = topTags.slice(0, 5);
+ const next5 = topTags.slice(5, 10);
+
return (
@@ -64,6 +75,46 @@ function SingleProfInfo({ rmp }: Props) {
Would take again
+
+ {first5.length > 0 && (
+
+
+ {first5.map((tag, index) => (
+
+ ))}
+ {next5.length > 0 && (
+ <>
+ {next5.map((tag, index) => (
+
+
+
+ ))}
+ setShowMore(!showMore)}
+ >
+
+
+ >
+ )}
+
+
+ )}
+