import React from 'react'; import { PlayCircle, Download, FileText, CheckCircle2 } from 'lucide-react'; import { Course, SectionVariant } from '../types'; interface CourseCardProps { course: Course; variant: SectionVariant; onClick?: (course: Course) => void; onOpenMaterials?: (course: Course) => void; } export const CourseCard: React.FC = ({ course, variant, onClick, onOpenMaterials }) => { const widthClass = variant === 'landscape' ? 'w-[320px] md:w-[420px]' : 'w-[200px] md:w-[260px]'; const aspectRatioClass = variant === 'landscape' ? 'aspect-video' : 'aspect-[3/4]'; // Count total materials (global + lesson specific) const globalAttachmentsCount = course.attachments?.length || 0; const lessonAttachmentsCount = course.lessons?.reduce((acc, l) => acc + (l.attachments?.length || 0), 0) || 0; const totalMaterials = globalAttachmentsCount + lessonAttachmentsCount; return (
{/* Thumbnail Container */}
onClick?.(course)} className={`relative ${aspectRatioClass} w-full overflow-hidden rounded-[8px] bg-zinc-900 shadow-xl transition-all duration-300 ease-out group-hover:scale-[1.02] group-hover:shadow-2xl group-hover:shadow-orange-500/10 group-hover:z-10 ring-0 ring-white/0 group-hover:ring-2 group-hover:ring-orange-500/40`} > {course.title} e.preventDefault()} className="h-full w-full object-cover transition-opacity duration-300 opacity-90 group-hover:opacity-100 rounded-[8px] select-none pointer-events-none" style={{ transform: `scale(${course.coverImageZoom || 1})`, objectPosition: `${course.coverImagePositionX ?? 50}% ${course.coverImagePositionY ?? 50}%`, }} /> {/* Badges on Thumbnail */}
{course.category.split('&')[0].trim()} {totalMaterials > 0 && ( {totalMaterials} {totalMaterials === 1 ? 'Material' : 'Materiais'} )}
{/* Hover Play Button Overlay */}
{/* Progress Bar */} {course.progress !== undefined && course.progress > 0 && (
)}
{/* Metadata */}

onClick?.(course)} className="text-body font-semibold text-white/95 line-clamp-1 group-hover:text-orange-400 transition-colors leading-body tracking-body" > {course.title}

{course.duration} {course.instructor && ( <> {course.instructor} )}
); };