'use client' import * as React from 'react' import Link from 'next/link' import { Play, Clock as ClockIcon } from 'iconoir-react' import { Card, CardContent } from '@/components/ui/card' import { Progress } from '@/components/ui/progress' import { formatTime } from '@/lib/utils' import { getCourseDisplayName } from '@/lib/course-display' interface ContinueWatchingCardProps { item: { lesson: { id: string title: string type: string duration: number | null thumbnail: string | null } progress: { position: number lastWatched: string } course: { name: string slug: string } module: { name: string } } index: number } export function ContinueWatchingCard({ item, index }: ContinueWatchingCardProps) { const { lesson, progress, course, module } = item const courseTitle = getCourseDisplayName(course) const percentage = lesson.duration && progress.position ? Math.min(100, (progress.position / lesson.duration) * 100) : 0 // Determine video thumbnail style based on course/module const getThumbClass = () => { const name = (courseTitle + ' ' + module.name).toLowerCase() if (name.includes('linux') || name.includes('terraform') || name.includes('shell')) return 'video-thumb-linux' if (name.includes('code') || name.includes('program') || name.includes('javascript') || name.includes('python')) return 'video-thumb-code' if (name.includes('automat') || name.includes('workflow') || name.includes('n8n')) return 'video-thumb-flow' return 'video-thumb-presenter' } return ( {/* Video Thumbnail */} {/* Duration badge */} {lesson.duration && ( {formatTime(lesson.duration)} )} {/* Play overlay */} {/* Progress bar overlay */} {progress.position && lesson.duration && ( )} {courseTitle} {lesson.title} {lesson.duration ? `${formatTime(progress.position || 0)} / ${formatTime(lesson.duration)}` : formatTime(progress.position || 0)} {lesson.duration && ( )} ) } interface ContinueWatchingSectionProps { items: Array<{ lesson: { id: string title: string type: string duration: number | null thumbnail: string | null } progress: { position: number lastWatched: string } course: { name: string slug: string } module: { name: string } }> } export function ContinueWatchingSection({ items }: ContinueWatchingSectionProps) { if (items.length === 0) return null return ( Continue Watching {items.map((item, index) => ( ))} ) }
{courseTitle}