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
No activity yet - start learning to see your timeline
{topic.category} • {topic.difficulty}