import type { JSX } from "react" import Link from "next/link" import { GraduationCap, TrendingUp, Award, BookOpen } from "lucide-react" import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@/shared/components/ui/card" import { Badge } from "@/shared/components/ui/badge" import { Progress } from "@/shared/components/ui/progress" import { EmptyState } from "@/shared/components/ui/empty-state" import { formatDate } from "@/shared/lib/utils" export interface ChildExamResultItem { submissionId: string examId: string examTitle: string assignmentId: string assignmentTitle: string score: number maxScore: number submittedAt: string | null status: string } interface ChildExamDetailProps { examResults: ChildExamResultItem[] childId: string childName: string } /** * V3-11: 家长端子女考试详情视图 * * 对标智学网家长端,展示: * - 考试成绩汇总卡片(已参加考试数、平均分、最高分) * - 考试成绩列表(考试标题、分数、得分率、提交时间) * - 成绩趋势可视化 */ export function ChildExamDetail({ examResults, childId, childName }: ChildExamDetailProps): JSX.Element { const hasResults = examResults.length > 0 const examCount = examResults.length const averageScore = hasResults ? examResults.reduce((sum, r) => { const rate = r.maxScore > 0 ? (r.score / r.maxScore) * 100 : 0 return sum + rate }, 0) / examCount : 0 const bestScore = hasResults ? Math.max(...examResults.map((r) => (r.maxScore > 0 ? (r.score / r.maxScore) * 100 : 0))) : 0 return (
{examCount}
Exams Taken
{averageScore.toFixed(1)}%
Average Score
{bestScore.toFixed(1)}%
Best Score