// LessonCard โ grid card for a standalone Lesson. Shared by LessonsList.jsx and // Dashboard.jsx's "Featured Lessons" section. Mirrors UnitCard.jsx; a Lesson has // no lesson_count/quiz_id of its own โ shows unit_count instead (how many Units // it's attached to). import { Timer, LockIcon, Layers } from "lucide-react"; import { Badge } from "@/components/ui/badge"; import { Skeleton } from "@/components/ui/skeleton"; import { cn } from "@/lib/utils"; function formatDuration(seconds = 0) { if (!seconds) return null; const h = Math.floor(seconds / 3600); const m = Math.floor((seconds % 3600) / 60); if (h && m) return `${h}h ${m}m`; if (h) return `${h}h`; return `${m}m`; } export const LessonCard = ({ lesson, onViewDetails }) => { const locked = lesson.is_locked; const duration = formatDuration(lesson.duration_seconds); const unitCount = Number(lesson.unit_count ?? 0); const courses = lesson.courses ?? []; return (
{lesson.description}
)}