import React from 'react'; import { TrendingUp, Award, Target, Calendar, BookOpen, Clock, Star, CheckCircle } from 'lucide-react'; import { ProgressData } from '../types'; interface ProgressSectionProps { progressData: ProgressData; } const ProgressSection: React.FC = ({ progressData }) => { const stats = [ { label: 'Study Streak', value: `${progressData.studyStreak} days`, icon: Calendar, color: 'text-primary-600', bgColor: 'bg-primary-50' }, { label: 'Topics Completed', value: progressData.topicsCompleted.toString(), icon: CheckCircle, color: 'text-success-600', bgColor: 'bg-success-50' }, { label: 'Study Time', value: `${progressData.totalStudyTime} hours`, icon: Clock, color: 'text-secondary-600', bgColor: 'bg-secondary-50' }, { label: 'Achievements', value: progressData.achievements.toString(), icon: Award, color: 'text-accent-600', bgColor: 'bg-accent-50' } ]; const getIconComponent = (iconName: string) => { const icons: { [key: string]: React.ComponentType } = { CheckCircle, BookOpen, Award, Calendar, Clock }; return icons[iconName] || BookOpen; }; const achievements = [ { title: 'First Steps', description: 'Complete your first study topic', earned: progressData.topicsCompleted >= 1, icon: '🎯' }, { title: 'Week Warrior', description: 'Study for 7 consecutive days', earned: progressData.studyStreak >= 7, icon: '🔥' }, { title: 'Knowledge Seeker', description: 'Complete 10 study topics', earned: progressData.topicsCompleted >= 10, icon: '📚' }, { title: 'Time Master', description: 'Study for 25 hours total', earned: progressData.totalStudyTime >= 25, icon: '⏰' }, { title: 'Dedicated Learner', description: 'Complete 50 study topics', earned: progressData.topicsCompleted >= 50, icon: '🎓' }, { title: 'Explorer', description: 'Study for 30 consecutive days', earned: progressData.studyStreak >= 30, icon: '🌍' } ]; const generateCalendarData = () => { const today = new Date(); const startDate = new Date(today); startDate.setDate(today.getDate() - 34); // Show last 35 days const calendarData = []; for (let i = 0; i < 35; i++) { const date = new Date(startDate); date.setDate(startDate.getDate() + i); // Simulate activity based on study streak const daysSinceToday = Math.floor((today.getTime() - date.getTime()) / (1000 * 60 * 60 * 24)); let intensity = 0; if (daysSinceToday <= progressData.studyStreak) { intensity = Math.random() * 0.8 + 0.2; // Active days } else { intensity = Math.random() * 0.3; // Less active days } calendarData.push({ date: date.toISOString().split('T')[0], intensity, isToday: daysSinceToday === 0 }); } return calendarData; }; const calendarData = generateCalendarData(); return (

Your Progress

Track your learning journey and achievements

{/* Stats Overview */}
{stats.map((stat) => { const Icon = stat.icon; return (

{stat.label}

{stat.value}

); })}
{/* Weekly Goal */}

Weekly Goal

Study Time {progressData.weeklyGoal.current} / {progressData.weeklyGoal.target} hours

You're {Math.round(Math.min((progressData.weeklyGoal.current / progressData.weeklyGoal.target) * 100, 100))}% of the way to your weekly goal!

{/* Recent Activity */}

Recent Activity

{progressData.recentActivity.length > 0 ? ( progressData.recentActivity.slice(0, 5).map((activity, index) => { const Icon = getIconComponent(activity.icon); return (

{activity.title}

{activity.course}

{activity.time}

); }) ) : (

No recent activity

Start studying to see your progress here!

)}
{/* Achievements */}

Achievements

{achievements.map((achievement, index) => (
{achievement.icon}

{achievement.title}

{achievement.description}

{achievement.earned && ( )}
))}
{/* Study Calendar Heatmap */}

Study Activity

Sun
Mon
Tue
Wed
Thu
Fri
Sat
{calendarData.map((day, i) => (
0.7 ? 'bg-primary-500' : day.intensity > 0.4 ? 'bg-primary-300' : day.intensity > 0.2 ? 'bg-primary-100' : 'bg-gray-100' }`} title={`${day.date}: Activity level ${Math.round(day.intensity * 100)}%`} /> ))}
Less active
More active
); }; export default ProgressSection;