/** * CourseLearningView — orchestration: hook + Header, Player, Tabs, Sidebar, modals. */ import React from 'react'; import { useToast } from '@/components/feedback/ToastProvider'; import { QuizModal } from '../modals/QuizModal'; import { CertificateModal } from '../modals/CertificateModal'; import { useCourseLearningView } from './useCourseLearningView'; import { CourseLearningViewHeader } from './CourseLearningViewHeader'; import { CourseLearningViewPlayer } from './CourseLearningViewPlayer'; import { CourseLearningViewTabs } from './CourseLearningViewTabs'; import { CourseLearningViewSidebar } from './CourseLearningViewSidebar'; import { CourseLearningViewSkeleton } from './CourseLearningViewSkeleton'; import type { CourseLearningViewProps } from './types'; export const CourseLearningView: React.FC = ({ course, onBack, isLoading = false, }) => { const { addToast } = useToast(); const { allLessons, currentLesson, currentLessonIndex, activeLessonId, setActiveLessonId, completedLessons, sidebarOpen, setSidebarOpen, activeTab, setActiveTab, progress, showQuiz, setShowQuiz, activeQuiz, showCertificate, setShowCertificate, markComplete, handleNext, handlePrev, startQuiz, } = useCourseLearningView(course); if (isLoading) { return ; } return (
setSidebarOpen((o) => !o)} />
{sidebarOpen && ( )}
{showQuiz && activeQuiz && ( setShowQuiz(false)} onComplete={(score) => { addToast(`Quiz Completed. Score: ${score}%`, 'info'); if (currentLesson) markComplete(currentLesson.id); }} /> )} {showCertificate && ( setShowCertificate(false)} /> )}
); };