"use client" import Link from "next/link" import { Award, AlertTriangle, Lightbulb, FileText, History, ArrowRight } from "lucide-react" import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "@/shared/components/ui/card" import { Badge } from "@/shared/components/ui/badge" import { Button } from "@/shared/components/ui/button" import { EmptyState } from "@/shared/components/ui/empty-state" import { formatDate } from "@/shared/lib/utils" import { MasteryRadarChart } from "./mastery-radar-chart" import type { DiagnosticReportWithDetails, MasteryRadarPoint, StudentMasterySummary } from "../types" interface StudentDiagnosticViewProps { summary: StudentMasterySummary | null reports: DiagnosticReportWithDetails[] classAverageMastery?: MasteryRadarPoint[] } export function StudentDiagnosticView({ summary, reports, classAverageMastery }: StudentDiagnosticViewProps) { if (!summary) { return ( ) } const radarData: MasteryRadarPoint[] = summary.allMastery.map((m) => { const classAvg = classAverageMastery?.find((c) => c.knowledgePoint === m.knowledgePointName) return { knowledgePoint: m.knowledgePointName, student: Math.round(m.masteryLevel * 100) / 100, classAverage: classAvg?.classAverage, } }) const publishedReports = reports.filter((r) => r.status === "published") const latestReport = publishedReports[0] ?? reports[0] ?? null return (
{/* 概览卡片 */}
Student

{summary.studentName}

Overall Mastery

{summary.averageMastery.toFixed(1)}%

Strengths

{summary.strengths.length}

Weaknesses

{summary.weaknesses.length}

{/* 雷达图 */} {/* 强项 / 弱项 */}
Strengths (≥80%) Knowledge points with high mastery. {summary.strengths.length === 0 ? (

No strengths identified yet.

) : (
    {summary.strengths.map((m) => (
  • {m.knowledgePointName} {m.masteryLevel.toFixed(1)}%
  • ))}
)}
Weaknesses (<60%) Knowledge points needing attention. {summary.weaknesses.length === 0 ? (

No weaknesses identified.

) : (
    {summary.weaknesses.map((m) => (
  • {m.knowledgePointName} {m.masteryLevel.toFixed(1)}%
  • ))}
)}
{/* 最新报告 / 建议 */} {latestReport ? ( Diagnostic Report {latestReport.status} Period: {latestReport.period ?? "-"} · Overall: {latestReport.overallScore?.toFixed(1) ?? "-"}% {latestReport.summary ? (

{latestReport.summary}

) : null} {latestReport.recommendations && latestReport.recommendations.length > 0 ? (

Recommendations

    {latestReport.recommendations.map((rec, i) => (
  • • {rec}
  • ))}
) : null}
) : null} {/* 历史报告列表 */} {publishedReports.length > 1 ? ( Report History Past diagnostic reports (newest first).
{publishedReports.map((r) => (
{r.period ?? "Untitled period"} {r.reportType}

{formatDate(r.createdAt)} {r.overallScore !== null ? ` · Overall: ${r.overallScore.toFixed(1)}%` : ""}

))}
) : null}
) }