Skip to content

Commit

Permalink
Change displayAcademicSessionName so tooltip can have "Fall 2024" and…
Browse files Browse the repository at this point in the history
… filter can display "2024 Fall" by passing in a boolean
  • Loading branch information
AbhiramTadepalli committed Jan 13, 2025
1 parent e87a410 commit e31145d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
26 changes: 18 additions & 8 deletions src/components/search/Filters/filters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
}

/**
Expand Down Expand Up @@ -310,7 +318,9 @@ const Filters = ({
value={session}
>
<Checkbox checked={chosenSessions.includes(session)} />
<ListItemText primary={displayAcademicSessionName(session)} />
<ListItemText
primary={displayAcademicSessionName(session, true)}
/>
</MenuItem>
))}
</Select>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,10 @@ function Row({
<Tooltip
title={
'Last taught in: ' +
displayAcademicSessionName(grades.data.most_recent_semester)
displayAcademicSessionName(
grades.data.most_recent_semester,
false,
)
}
placement="top"
>
Expand Down

0 comments on commit e31145d

Please sign in to comment.