import { Badge } from '@/components/ui/badge'; import { Button } from '@/components/ui/button'; import { Card, CardContent, CardFooter } from '@/components/ui/card'; import { cn, systemCurrency } from '@/lib/utils'; import { SharedData } from '@/types/global'; import { Link, usePage } from '@inertiajs/react'; import { Clock, Heart, ShoppingCart, Users } from 'lucide-react'; import RatingDisplay from './rating-display'; interface Props { exam: Exam; variant?: 'default' | 'compact'; viewType?: 'grid' | 'list'; onAddToCart?: (exam: Exam) => void; onAddToWishlist?: (exam: Exam) => void; className?: string; } const ExamCard1 = ({ exam, variant = 'default', viewType = 'grid', onAddToCart, onAddToWishlist, className }: Props) => { const { props } = usePage(); const { translate } = props; const { common } = translate; const showWishlist = props.system.fields?.show_student_wishlist !== false; const isCompact = variant === 'compact'; const examUrl = route('exams.details', { slug: exam.slug, id: exam.id }); const currency = systemCurrency(props.system.fields['selling_currency']); return (
{exam.thumbnail ? ( {exam.title} ) : (
{exam.title.charAt(0)}
)} {exam.level && {exam.level}}

{exam.title}

{!isCompact && exam.short_description &&

{exam.short_description}

}
by {exam.instructor?.user?.name || 'Instructor'}
{exam.duration_hours}h {exam.duration_minutes}m
{exam.enrollments_count || 0} students
{exam.average_rating !== undefined && ( )}
{exam.pricing_type === 'free' ? ( common.free ) : exam.discount ? ( <> {currency?.symbol} {exam.discount_price} {currency?.symbol} {exam.price} ) : ( <> {currency?.symbol} {exam.price} )}
{showWishlist && onAddToWishlist && ( )} {onAddToCart && exam.pricing_type === 'paid' && ( )}
); }; export default ExamCard1;