import DashboardLayout from '@/Layouts/DashboardLayout'; import { Head, Link, useForm } from '@inertiajs/react'; import { Card, CardContent, CardHeader, CardTitle, CardDescription, CardFooter } from "@/Components/ui/card"; import { Button } from "@/Components/ui/button"; import { Badge } from "@/Components/ui/badge"; import { BookOpen, CheckCircle2, Play } from "lucide-react"; interface Course { id: string; title: string; description: string; thumbnail: string; slug: string; modulesCount: number; isEnrolled: boolean; } interface Level { id: string; name: string; code: string; courses: Course[]; } interface Props { levels: Level[]; } export default function Library({ levels }: Props) { return (

Galeri Kursus

Pilih materi yang ingin kamu pelajari hari ini.

} >
{levels.length > 0 ? levels.map((level) => (

{level.name} ({level.code})

{level.courses.map((course) => ( ))}
)) : (

Belum ada materi tersedia saat ini.

)}
); } function CourseCard({ course }: { course: Course }) { const { post, processing } = useForm(); const handleEnroll = () => { post(route('courses.enroll', course.slug)); }; return (
{course.title}
{course.isEnrolled && ( Terdaftar )}
{course.modulesCount} Materi
{course.title} {course.description}
{course.isEnrolled ? ( ) : ( )} ); }