import Link from "next/link" import { ChevronRight, Users } from "lucide-react" import { Avatar, AvatarFallback, AvatarImage } from "@/shared/components/ui/avatar" import { Badge } from "@/shared/components/ui/badge" import { Button } from "@/shared/components/ui/button" import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/shared/components/ui/card" import { formatDate } from "@/shared/lib/utils" interface StudentSummary { id: string name: string email: string image?: string | null status: string subjectScores?: Record } interface ClassStudentsWidgetProps { classId: string students: StudentSummary[] } export function ClassStudentsWidget({ classId, students }: ClassStudentsWidgetProps) { const activeCount = students.filter(s => s.status === "active").length return (
Students {activeCount} active students
{students.length === 0 ? (

No students enrolled yet.

) : (
{students.slice(0, 6).map((student) => (
{student.name .split(" ") .map((n) => n[0]) .join("") .toUpperCase() .slice(0, 2)}
{student.name}
{student.email}
{student.status}
{/* Subject Scores */} {student.subjectScores && Object.keys(student.subjectScores).length > 0 && (
{Object.entries(student.subjectScores).map(([subject, score]) => (
{subject} {score !== null ? ( = 60 ? "font-semibold text-primary" : "font-semibold text-destructive"}> {score} ) : ( - )}
))}
)}
))}
)}
) }