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)} + > + + + + )} +
+
+ )} +