From e31145ddc00c3cd429e9fd53120071d9146f5bb8 Mon Sep 17 00:00:00 2001 From: AbhiramTadepalli Date: Mon, 13 Jan 2025 13:58:04 -0600 Subject: [PATCH] Change displayAcademicSessionName so tooltip can have "Fall 2024" and filter can display "2024 Fall" by passing in a boolean --- src/components/search/Filters/filters.tsx | 26 +++++++++++++------ .../SearchResultsTable/searchResultsTable.tsx | 5 +++- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/components/search/Filters/filters.tsx b/src/components/search/Filters/filters.tsx index e2e77e84..d00d1299 100644 --- a/src/components/search/Filters/filters.tsx +++ b/src/components/search/Filters/filters.tsx @@ -39,13 +39,21 @@ export function compareSemesters(a: string, b: string) { } else return x; } -export function displayAcademicSessionName(id: string) { - return ( - '20' + - id.slice(0, 2) + - ' ' + - { U: 'Summer', F: 'Fall', S: 'Spring' }[id.slice(2)] - ); +export function displayAcademicSessionName(id: string, yearFirst: boolean) { + if (yearFirst) + return ( + '20' + + id.slice(0, 2) + + ' ' + + { U: 'Summer', F: 'Fall', S: 'Spring' }[id.slice(2)] + ); + else + return ( + { U: 'Summer', F: 'Fall', S: 'Spring' }[id.slice(2)] + + ' ' + + '20' + + id.slice(0, 2) + ); } /** @@ -310,7 +318,9 @@ const Filters = ({ value={session} > - + ))} diff --git a/src/components/search/SearchResultsTable/searchResultsTable.tsx b/src/components/search/SearchResultsTable/searchResultsTable.tsx index 014b69ef..f15a3268 100644 --- a/src/components/search/SearchResultsTable/searchResultsTable.tsx +++ b/src/components/search/SearchResultsTable/searchResultsTable.tsx @@ -205,7 +205,10 @@ function Row({