import LiveClassStatus from '@/components/live-class-status'; import Tabs from '@/components/tabs'; import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '@/components/ui/accordion'; import { Button } from '@/components/ui/button'; import { Card, CardHeader } from '@/components/ui/card'; import { Progress } from '@/components/ui/progress'; import { ScrollArea } from '@/components/ui/scroll-area'; import { Separator } from '@/components/ui/separator'; import { TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; import { CoursePlayerProps } from '@/types/page'; import { Link, router, usePage } from '@inertiajs/react'; import { format, parseISO } from 'date-fns'; import { Calendar, Clock } from 'lucide-react'; import { Renderer } from 'richtor'; import 'richtor/styles'; import Lesson from './lesson'; import Quiz from './quiz'; interface ContentListProps { completedContents: CompletedContent[]; courseCompletion: { percentage: string; totalContents: number; completedContents: number; }; } const ContentList = ({ completedContents, courseCompletion }: ContentListProps) => { const { props } = usePage(); const { course, zoomConfig, section, watchHistory, translate, direction, system } = props; const { button, common, frontend } = translate; const showCourseCertificate = system?.fields?.show_course_certificate ?? true; const showCourseMarksheet = system?.fields?.show_course_marksheet ?? showCourseCertificate; const showCertificateTab = showCourseCertificate || showCourseMarksheet; const certificateLabel = showCourseCertificate ? frontend.course_certificate : button.marksheet || 'Notenblatt'; // Get live classes from course data const liveClasses = course.live_classes || []; // Get the last section const lastSection = props.course.sections[props.course.sections.length - 1]; // Get the last content based on current_watching_type let lastContent; if (watchHistory.current_watching_type === 'lesson') { lastContent = lastSection.section_lessons.find((lesson) => lesson.id.toString() === watchHistory.current_watching_id); } else { lastContent = lastSection.section_quizzes.find((quiz) => quiz.id.toString() === watchHistory.current_watching_id); } const finishCourseHandler = () => { router.get(route('course.player.finish', { watch_history: watchHistory.id })); }; return (
{button.lessons} {button.live_classes}

{courseCompletion.percentage}% {common.completed} {courseCompletion.completedContents}/{courseCompletion.totalContents}

{section ? ( {props.course.sections.map((section, ind) => ( {ind + 1}. {section.title} {section.section_lessons.length > 0 ? ( <> {section.section_lessons.map((lesson) => ( ))} {section.section_quizzes.map((quiz) => ( ))} ) : (

Keine Lektion vorhanden

)}
))} {watchHistory.completion_date ? (
) : (
{!watchHistory.next_watching_id ? ( ) : ( )}
)}
) : (

Kein Abschnitt vorhanden

)}
{liveClasses.length <= 0 ? (

Keine Live-Sitzungen geplant

Plane deine erste Live-Session, um mit Zoom zu starten.

) : ( liveClasses.map((liveClass) => { return (

{liveClass.class_topic}

{format(parseISO(liveClass.class_date_and_time), 'p')}
{format(parseISO(liveClass.class_date_and_time), 'PPP')}
{liveClass.class_note && ( Hinweis zur Sitzung )}
); }) )}
); }; export default ContentList;