diff --git a/src/components/GenerateCourse/AICourseCard.tsx b/src/components/GenerateCourse/AICourseCard.tsx index 9db197881..04dad0e3b 100644 --- a/src/components/GenerateCourse/AICourseCard.tsx +++ b/src/components/GenerateCourse/AICourseCard.tsx @@ -2,6 +2,7 @@ import type { AICourseWithLessonCount } from '../../queries/ai-course'; import type { DifficultyLevel } from './AICourse'; import { BookOpen } from 'lucide-react'; import { AICourseActions } from './AICourseActions'; +import { getRelativeTimeString } from '../../lib/date'; type AICourseCardProps = { course: AICourseWithLessonCount; @@ -12,7 +13,6 @@ type AICourseCardProps = { export function AICourseCard(props: AICourseCardProps) { const { course, showActions = true, showProgress = true } = props; - // Map difficulty to color const difficultyColor = { beginner: 'text-green-700', @@ -20,17 +20,18 @@ export function AICourseCard(props: AICourseCardProps) { advanced: 'text-purple-700', }[course.difficulty as DifficultyLevel] || 'text-gray-700'; - // Calculate progress percentage + const modulesCount = course.modules?.length || 0; const totalTopics = course.lessonCount || 0; const completedTopics = course.done?.length || 0; const progressPercentage = totalTopics > 0 ? Math.round((completedTopics / totalTopics) * 100) : 0; + const updatedAgo = getRelativeTimeString(course?.updatedAt); return (
-

+

{course.title}

-
+
+
+ + {modulesCount} modules +
+ + +
{totalTopics} lessons
+
- {showProgress && totalTopics > 0 && ( -
-
+ {showProgress && totalTopics > 0 && ( +
+
+ Progress + + + {progressPercentage}% + +
+ +
+
- - {progressPercentage}% -
- )} +
+ )} + +
+ + Last updated {updatedAgo} +