Skip to content

Commit

Permalink
feat: classCode now based on user's language (#389)
Browse files Browse the repository at this point in the history
  • Loading branch information
ImJustChew authored Aug 26, 2024
2 parents e95e5c9 + 3d94fe1 commit f00764b
Show file tree
Hide file tree
Showing 4 changed files with 1,087 additions and 53 deletions.
7 changes: 3 additions & 4 deletions src/app/[lang]/(mods-pages)/courses/ClasssRefinementItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ const ClassRefinementItem = ({
"All"
) : (
<div className="flex flex-col gap-1">
{selected.map((i) => (
{selected.map(i =>
<Badge key={i} variant="outline" className="">
{getFormattedClassCode(i, selectedSemester)}
{getFormattedClassCode(i, selectedSemester, 'zh')}
</Badge>
))}
</div>
Expand All @@ -121,7 +121,6 @@ const ClassRefinementItem = ({
<X className="px-2 w-8 h-6 cursor-pointer" onClick={clear} />
)}
</Button>

<PopoverContent className="p-0" align="start">
<Command shouldFilter={clientSearch}>
{searchable && (
Expand Down Expand Up @@ -164,7 +163,7 @@ const ClassRefinementItem = ({
/>
</div>
<span className="mr-4">
{getFormattedClassCode(item.label, selectedSemester)}
{getFormattedClassCode(item.label, selectedSemester, 'zh')}
</span>
<Badge variant="outline">{item.count}</Badge>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/components/CourseDetails/CourseDetailsContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ const CourseDetailContainer = async ({
href={`/${lang}/courses?nthu_courses%5BrefinementList%5D%5Bcompulsory_for%5D%5B0%5D=${course.compulsory_for}`}
>
<Badge variant="outline">
{getFormattedClassCode(m, course.semester)}
{getFormattedClassCode(m, course.semester, lang)}
</Badge>
</Link>
))}
Expand All @@ -519,7 +519,7 @@ const CourseDetailContainer = async ({
href={`/${lang}/courses?nthu_courses%5BrefinementList%5D%5Belective_for%5D%5B0%5D=${course.elective_for}`}
>
<Badge variant="outline">
{getFormattedClassCode(m, course.semester)}
{getFormattedClassCode(m, course.semester, lang)}
</Badge>
</Link>
))}
Expand Down
Loading

0 comments on commit f00764b

Please sign in to comment.