mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
@@ -21,6 +21,7 @@ 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 (
|
||||
<div
|
||||
@@ -34,14 +35,23 @@ export const LessonCard = ({ lesson, onViewDetails }) => {
|
||||
onClick={() => onViewDetails(lesson)}
|
||||
>
|
||||
<div className="flex flex-wrap gap-1.5">
|
||||
{locked ? (
|
||||
{locked && (
|
||||
<Badge variant="secondary">
|
||||
<LockIcon className="size-3" /> Locked
|
||||
</Badge>
|
||||
) : unitCount > 0 ? (
|
||||
<Badge variant="outline"><Layers className="size-3" /> In {unitCount} unit{unitCount === 1 ? "" : "s"}</Badge>
|
||||
)}
|
||||
{unitCount > 0 ? (
|
||||
<Badge variant="outline">
|
||||
<Layers className="size-3" /> In {unitCount} unit{unitCount === 1 ? "" : "s"}
|
||||
{courses[0] && (
|
||||
<>
|
||||
{" "}· <span className="truncate max-w-[120px] inline-block align-bottom">{courses[0].title}</span>
|
||||
{courses.length > 1 ? ` +${courses.length - 1}` : ""}
|
||||
</>
|
||||
)}
|
||||
</Badge>
|
||||
) : (
|
||||
<Badge variant="outline" className="text-muted-foreground">Standalone</Badge>
|
||||
!locked && <Badge variant="outline" className="text-muted-foreground">Standalone</Badge>
|
||||
)}
|
||||
</div>
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ export const UnitCard = ({ unit, onViewDetails }) => {
|
||||
const duration = formatDuration(unit.duration_seconds);
|
||||
const lessonCount = Number(unit.lesson_count ?? 0);
|
||||
const courseCount = Number(unit.course_count ?? 0);
|
||||
const courses = unit.courses ?? [];
|
||||
|
||||
return (
|
||||
<div
|
||||
@@ -33,14 +34,19 @@ export const UnitCard = ({ unit, onViewDetails }) => {
|
||||
onClick={() => onViewDetails(unit)}
|
||||
>
|
||||
<div className="flex flex-wrap gap-1.5">
|
||||
{locked ? (
|
||||
{locked && (
|
||||
<Badge variant="secondary">
|
||||
<LockIcon className="size-3" /> Locked
|
||||
</Badge>
|
||||
) : courseCount > 0 ? (
|
||||
<Badge variant="outline"><BookOpen className="size-3" /> In {courseCount} course{courseCount === 1 ? "" : "s"}</Badge>
|
||||
)}
|
||||
{courseCount > 0 ? (
|
||||
<Badge variant="outline">
|
||||
<BookOpen className="size-3" />
|
||||
<span className="truncate max-w-[140px] inline-block align-bottom">{courses[0]?.title ?? "Course"}</span>
|
||||
{courseCount > 1 ? ` +${courseCount - 1}` : ""}
|
||||
</Badge>
|
||||
) : (
|
||||
<Badge variant="outline" className="text-muted-foreground">Standalone</Badge>
|
||||
!locked && <Badge variant="outline" className="text-muted-foreground">Standalone</Badge>
|
||||
)}
|
||||
{unit.quiz_id && (
|
||||
<Badge variant="outline"><ClipboardList className="size-3" /> Quiz</Badge>
|
||||
|
||||
Reference in New Issue
Block a user