import React from 'react' import { motion } from 'framer-motion' import { Calendar, CheckCircle, Clock, TrendingUp } from 'lucide-react' const ProgressTimeline = ({ topics }) => { // Filter and sort topics by last practice date const timelineData = topics .filter(topic => topic.practice_count > 0) .sort((a, b) => new Date(b.last_practiced) - new Date(a.last_practiced)) .slice(0, 10) // Show last 10 activities const formatDate = (dateString) => { const date = new Date(dateString) const now = new Date() const diffTime = Math.abs(now - date) const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)) if (diffDays === 0) return 'Today' if (diffDays === 1) return 'Yesterday' if (diffDays < 7) return `${diffDays} days ago` if (diffDays < 30) return `${Math.floor(diffDays / 7)} weeks ago` return `${Math.floor(diffDays / 30)} months ago` } const getStatusColor = (level) => { if (level >= 0.8) return 'from-green-500 to-emerald-500' if (level >= 0.6) return 'from-blue-500 to-cyan-500' if (level >= 0.4) return 'from-yellow-500 to-orange-500' return 'from-red-500 to-pink-500' } const getStatusIcon = (level) => { if (level >= 0.8) return if (level >= 0.6) return return } if (timelineData.length === 0) { return (

Recent Activity

No activity yet - start learning to see your timeline

) } return (

Recent Learning Activity

{/* Timeline line */}
{/* Timeline items */}
{timelineData.map((topic, index) => ( {/* Timeline dot */}
{getStatusIcon(topic.knowledge_level)}
{/* Content */}

{topic.name}

{topic.category} • {topic.difficulty}

{formatDate(topic.last_practiced)}
{/* Progress bar */}
Knowledge Level {Math.round(topic.knowledge_level * 100)}%
{/* Stats */}
Practice Sessions
{topic.practice_count}
Confidence
{Math.round(topic.confidence * 100)}%
))}
) } export default ProgressTimeline