import { cn } from '@/lib/utils'; import { CoursePlayerProps } from '@/types/page'; import { Link, usePage } from '@inertiajs/react'; import { Circle, CircleCheck, CirclePause, CirclePlay, FileQuestion, Lock } from 'lucide-react'; interface Props { quiz: SectionQuiz; completed: { id: number | string; type: string }[]; } const QuizIcon = ({ quiz }: { quiz: SectionQuiz }) => { return (

{quiz.title}

); }; const Quiz = ({ quiz, completed }: Props) => { const { props } = usePage(); const { course, watchHistory } = props; const dripContent = Boolean(course.drip_content); const isCompleted = completed.some((item) => item.type === 'quiz' && item.id == quiz.id); const isCurrentLesson = watchHistory.current_watching_type === 'quiz' && watchHistory.current_watching_id == quiz.id; const isNext = watchHistory.next_watching_type === 'quiz' && quiz.id == watchHistory.next_watching_id; return !dripContent ? (
{isCompleted ? : } {quiz.duration}
) : ( <> {isCompleted || isCurrentLesson || isNext ? (
{isCompleted ? ( ) : isCurrentLesson ? ( ) : isNext ? ( ) : ( )} {quiz.duration}
) : (
{quiz.duration}
)} ); }; export default Quiz;