import Link from "next/link"; import { formatDuration } from "@/lib/courses"; import { Icon } from "../Icon"; type Lesson = { id: string; title: string; description: string; duration: number; preview: boolean; videoId: string }; type Chapter = { id: string; title: string; lessons: Lesson[] }; /** * Kapitel und Einheiten eines Kurses. Auf der Produktseite mit Vorschau-Links, * in „Meine Kurse“ mit Links zu allen Einheiten und Haken für erledigte. */ export function CourseOutline({ chapters, hrefFor, current, done }: { chapters: Chapter[]; hrefFor: (l: Lesson) => string | null; current?: string; done?: Set }) { if (!chapters.length) return null; let n = 0; return (
{chapters.map((c) => (

{c.title}

    {c.lessons.map((l) => { n++; const href = l.videoId ? hrefFor(l) : null; const body = ( <> {l.title} {l.preview && !done && Vorschau} {formatDuration(l.duration)} ); return (
  1. {href ? {body} : {body}}
  2. ); })}
))}
); }