diff --git a/src/app/[lang]/(mods-pages)/student/grades/GradesViewer.tsx b/src/app/[lang]/(mods-pages)/student/grades/GradesViewer.tsx index f89b6a68..d43563de 100644 --- a/src/app/[lang]/(mods-pages)/student/grades/GradesViewer.tsx +++ b/src/app/[lang]/(mods-pages)/student/grades/GradesViewer.tsx @@ -1,4 +1,6 @@ "use client"; +import { useSettings } from "@/hooks/contexts/settings"; +import useDictionary from "@/dictionaries/useDictionary"; import { Badge } from "@/components/ui/badge"; import { Table, @@ -32,6 +34,7 @@ import { } from "@/components/ui/dialog"; import { ExternalLink } from "lucide-react"; import dynamic from "next/dynamic"; +import { distinct } from "rxjs"; const GPAChart = dynamic(async () => (await import("./GPAChart")).GPAChart, { ssr: false, @@ -47,9 +50,12 @@ const DeptRankChart = dynamic( const SemesterGradeCard = ({ semester, + language, }: { semester: GradeObject["ranking"]["data"][number]; + language: string; }) => { + const dict = useDictionary(); return ( @@ -71,13 +77,13 @@ const SemesterGradeCard = ({ {semester.gpa} - T 分數成績 + {dict.grade.t_score} {semester.t_score_avg} - 修課相對成績平均 + {dict.grade.relative_avg} {semester.relative_avg} @@ -90,25 +96,25 @@ const SemesterGradeCard = ({ - 修習/實得學分 + {dict.grade.taken_actual_credits} {semester.credits}/{semester.actual_credits} - 修課數 + {dict.grade.num_of_courses} {semester.num_of_courses} - 暑修學分 + {dict.grade.summer_credits} {semester.summer_credits} - 抵免學分 + {dict.grade.transfer_credits} {semester.transfer_credits} @@ -121,25 +127,25 @@ const SemesterGradeCard = ({ - 班排名 + {dict.grade.class_rank} {semester.letter_class_rank} - 系排名 + {dict.grade.dept_rank} {semester.letter_dept_rank} - T分數班排名 + {dict.grade.t_score_class_rank} {semester.t_score_class_rank} - T分數系排名 + {dict.grade.t_score_dept_rank} {semester.t_score_dept_rank} @@ -164,26 +170,27 @@ const GradeCard = ({ title, data }: { title: string; data: string }) => ( ); const GradeOverview = ({ grades }: { grades: GradeObject }) => { + const dict = useDictionary(); return (
@@ -230,6 +237,10 @@ const GradesViewer = ({ grades }: { grades: GradeObject }) => { const [tab, setTab] = useState<"courses" | "semester">("courses"); + const { language } = useSettings(); + + const dict = useDictionary(); + return (
@@ -251,8 +262,10 @@ const GradesViewer = ({ grades }: { grades: GradeObject }) => { >
- 全部課程 - 學期成績 + {dict.grade.all_courses} + + {dict.grade.semester_grades} + {tab == "courses" && ( )} @@ -325,7 +340,11 @@ const GradesViewer = ({ grades }: { grades: GradeObject }) => { {grade.course_id} - {grade.name_zh} + + {language == "en" + ? grade.name_en + : grade.name_zh} +
{grade.ge_description && (
@@ -360,25 +379,33 @@ const GradesViewer = ({ grades }: { grades: GradeObject }) => { - 學期 + + {dict.grade.semester} + GPA T-Score - 修課相對成績平均 + {dict.grade.relative_avg} + + + {dict.grade.taken_actual_credits} + + + {dict.grade.num_of_courses} + + + {dict.grade.summer_credits} - 修習/實得學分 + {dict.grade.transfer_credits} - 修課數 - 暑修學分 - 抵免學分 - 班排名 - 系排名 + {dict.grade.class_rank} + {dict.grade.dept_rank} - T分數班排名 + {dict.grade.t_score_class_rank} - T分數系排名 + {dict.grade.t_score_dept_rank} @@ -417,7 +444,10 @@ const GradesViewer = ({ grades }: { grades: GradeObject }) => { {semester.t_score_dept_rank} - + ))} @@ -428,7 +458,7 @@ const GradesViewer = ({ grades }: { grades: GradeObject }) => { {!isMobile && (
- 成績曲線圖 + {dict.grade.score_curve}
@@ -441,7 +471,7 @@ const GradesViewer = ({ grades }: { grades: GradeObject }) => { - 班排名 + {dict.grade.class_rank} @@ -449,7 +479,7 @@ const GradesViewer = ({ grades }: { grades: GradeObject }) => { - 系排名 + {dict.grade.dept_rank} @@ -463,8 +493,12 @@ const GradesViewer = ({ grades }: { grades: GradeObject }) => {
GPA - 班排名 - 系排名 + + {dict.grade.class_rank} + + + {dict.grade.dept_rank} +
diff --git a/src/dictionaries/en.json b/src/dictionaries/en.json index 776efe8d..a1ae5020 100644 --- a/src/dictionaries/en.json +++ b/src/dictionaries/en.json @@ -296,6 +296,26 @@ "logging_in_please_wait": "Logging into your Academic Information System Account...", "not_logged_in_error": "You are not logged in" }, + "grade": { + "class_rank": "Class Ranking", + "dept_rank": "Department Ranking", + "passed_credits": "Passed credits", + "pending_credits": "Pending credits", + "semester": "Semester", + "relative_avg": "Relative Grade Average", + "num_of_courses": "Number of Courses", + "summer_credits": "Summer Credits", + "transfer_credits": "Transfer Credits", + "t_score_class_rank": "T-Score Class Ranking", + "t_score_dept_rank": "T-Score Department Ranking", + "latest_first": "Latest First", + "oldest_first": "Oldest First", + "score_curve": "Score Curve", + "taken_actual_credits": "Taken/Actual Credits", + "all_courses": "All Courses", + "semester_grades": "Semester Grades", + "t_score": "T-Score" + }, "cancel": "Cancel", "privacy_policy": "Privacy Policy" } diff --git a/src/dictionaries/zh.json b/src/dictionaries/zh.json index 5bde5342..d7d28b27 100644 --- a/src/dictionaries/zh.json +++ b/src/dictionaries/zh.json @@ -296,6 +296,26 @@ "logging_in_please_wait": "正在幫你登入校務資訊系統,請稍等...", "not_logged_in_error": "還未連接校務資訊系統" }, + "grade": { + "class_rank": "班排名", + "dept_rank": "系排名", + "passed_credits": "及格學分", + "pending_credits": "成績未到學分", + "semester": "學期", + "relative_avg": "修課相對成績平均", + "num_of_courses": "修課數", + "summer_credits": "暑修學分", + "transfer_credits": "抵免學分", + "t_score_class_rank": "T分數班排名", + "t_score_dept_rank": "T分數系排名", + "latest_first": "由遠到近", + "oldest_first": "由近到遠", + "score_curve": "成績曲線圖", + "taken_actual_credits": "修習/實得學分", + "all_courses": "全部課程", + "semester_grades": "學期成績", + "t_score": "T 分數成績" + }, "cancel": "取消", "privacy_policy": "隱私權政策" }