import { Link, useNavigate } from "@tanstack/react-router"; import { Button } from "@pram/ui/components/button"; import { Card, CardContent } from "@pram/ui/components/card"; import { MaterialIcon } from "@/components/ui/MaterialIcon"; import { toast } from "sonner"; export interface PackageItem { id: string; title: string; description?: string | null; examTypeName?: string | null; isPublic: boolean; creatorUserId?: string | null; totalQuestions: number; totalSections: number; estimatedDurationMin?: number | null; usageCount: number; avgRating?: number | null; } interface PackageCardProps { pkg: PackageItem; isOwner: boolean; bulkMode: boolean; isSelected: boolean; isTogglePending?: boolean; onToggleSelect: () => void; onTogglePublic: () => void; } export function PackageCard({ pkg, isOwner, bulkMode, isSelected, isTogglePending = false, onToggleSelect, onTogglePublic, }: PackageCardProps) { const navigate = useNavigate(); const isPrivate = isOwner && !pkg.isPublic; return ( {/* Clickable content area */}
{bulkMode && ( {isSelected ? "Terpilih" : "Pilih"} )} {pkg.examTypeName && ( {pkg.examTypeName} )}
{pkg.avgRating && (
{pkg.avgRating}
)}

{pkg.title}

{pkg.description && (

{pkg.description}

)}
{pkg.totalQuestions} {pkg.totalSections} {pkg.estimatedDurationMin && ( {pkg.estimatedDurationMin}m )}
{pkg.usageCount}x digunakan
{/* Owner actions */} {isOwner && !bulkMode && (
{pkg.isPublic && ( )}
)} {/* CTA */} {!bulkMode && (
)}
); }