import React from 'react'; import { BookOpen, Award, Clock, TrendingUp } from 'lucide-react'; import type { Course, CourseAssignment } from '../../types/index.js'; interface LearningDashboardProps { courses?: Course[]; assignments?: CourseAssignment[]; } export const LearningDashboard: React.FC = ({ courses = [], assignments = [], }) => { const completed = assignments.filter(a => a.status === 'COMPLETED'); const inProgress = assignments.filter(a => a.status === 'IN_PROGRESS'); const overdue = assignments.filter(a => a.status === 'OVERDUE'); const avgProgress = assignments.length > 0 ? assignments.reduce((sum, a) => sum + (a.progress || 0), 0) / assignments.length : 0; return (

Learning Dashboard

Total Courses

{courses.length}

Completed

{completed.length}

In Progress

{inProgress.length}

Avg Progress

{avgProgress.toFixed(0)}%

{overdue.length > 0 && (

{overdue.length} overdue assignment{overdue.length !== 1 ? 's' : ''}

)}

Recent Assignments

{assignments.slice(0, 10).map((assignment) => { const course = courses.find(c => c.id === assignment.courseId); const progress = assignment.progress || 0; return (

{course?.title || 'Unknown Course'}

Employee ID: {assignment.employeeId}

{assignment.dueDate && (

Due: {assignment.dueDate}

)}
{assignment.status.replace('_', ' ')}
Progress {progress}%
{assignment.completedAt && (

Completed: {assignment.completedAt} {assignment.score !== undefined && ` • Score: ${assignment.score}%`}

)}
); })}
); };