Skip to content

Commit 6dd0bac

Browse files
Merge pull request #332 from aarushi-patidar/aarushi/sidebar
fix: sort slots and years in ascending order
2 parents 2ccfa22 + 6fe722f commit 6dd0bac

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/components/SideBar.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,13 @@ function SideBar({
4848
const exams =
4949
filterOptions?.unique_exams.map((exam) => ({ label: exam, value: exam })) ?? [];
5050
const slots =
51-
filterOptions?.unique_slots.map((slot) => ({ label: slot, value: slot })) ?? [];
51+
filterOptions?.unique_slots
52+
.sort((a, b) => a.localeCompare(b, undefined, { numeric: true }))
53+
.map((slot) => ({ label: slot, value: slot })) ?? [];
5254
const years =
53-
filterOptions?.unique_years.map((year) => ({ label: year, value: year })) ?? [];
55+
filterOptions?.unique_years
56+
.sort((a, b) => b.localeCompare(a))
57+
.map((year) => ({ label: year, value: year })) ?? [];
5458
const semesters =
5559
filterOptions?.unique_semesters.map((semester) => ({
5660
label: semester,

0 commit comments

Comments
 (0)