"use client" import { TrendingUp } from "lucide-react" import { useTranslations } from "next-intl" import { ChartCardShell } from "@/shared/components/charts/chart-card-shell" import { TrendLineChart } from "@/shared/components/charts/trend-line-chart" import type { TeacherGradeTrendItem } from "@/modules/homework/types" export function TeacherGradeTrends({ trends }: { trends: TeacherGradeTrendItem[] }) { const t = useTranslations("dashboard") const hasTrends = trends.length > 0 const chartData = trends.map((item) => { const percentage = item.maxScore > 0 ? (item.averageScore / item.maxScore) * 100 : 0 return { title: item.title, score: Math.round(percentage), fullTitle: item.title, submissionCount: item.submissionCount, totalStudents: item.totalStudents, } }) return (
{chartData .slice() .reverse() .slice(0, 3) .map((item, i) => (
{item.fullTitle}
{item.score}%
{t("chart.submittedCount", { submitted: item.submissionCount, total: item.totalStudents })}
))}
) }