"use client" import { BarChart3 } from "lucide-react" import { CartesianGrid, Line, LineChart, XAxis, YAxis } from "recharts" import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@/shared/components/ui/card" import { ChartContainer, ChartTooltip, ChartTooltipContent, } from "@/shared/components/ui/chart" import { EmptyState } from "@/shared/components/ui/empty-state" import { formatDate } from "@/shared/lib/utils" import type { GradeTrendResult } from "@/modules/grades/types" const chartConfig = { normalizedScore: { label: "Score (%)", color: "hsl(var(--primary))", }, } interface GradeTrendChartProps { data: GradeTrendResult | null } export function GradeTrendChart({ data }: GradeTrendChartProps) { if (!data || data.points.length === 0) { return ( Grade Trend Score progression over time (normalized to 0-100). ) } const chartData = data.points.map((p) => ({ title: p.title, normalizedScore: p.normalizedScore, fullTitle: p.title, date: formatDate(p.date), rawScore: p.score, fullScore: p.fullScore, type: p.type, })) return ( Grade Trend {data.label} ยท avg {data.averageScore.toFixed(1)}% value.length > 10 ? `${value.slice(0, 10)}...` : value } /> `${value}%`} width={36} /> } /> ) }