"use client"; import Link from "next/link"; import { Book, CheckCircle } from "lucide-react"; import { CachedImage } from "./CachedImage"; interface AudiobookCardProps { id: string; title: string; author: string; coverUrl: string | null; progress?: { progress: number; isFinished: boolean; } | null; seriesBadge?: string; // e.g., "5 books" for series cards index?: number; getCoverUrl: (url: string) => string | null; } export function AudiobookCard({ id, title, author, coverUrl, progress, seriesBadge, index = 0, getCoverUrl, }: AudiobookCardProps) { const resolvedCoverUrl = coverUrl ? getCoverUrl(coverUrl) : null; return (
{/* Book Cover Container - Fixed Aspect Ratio */}
{resolvedCoverUrl ? ( { e.currentTarget.style.display = "none"; }} /> ) : (
)} {/* Book Spine Shadow */}
{/* Book Gloss */}
{/* Progress Bar */} {progress && !progress.isFinished && (
)} {/* Completion Badge */} {progress?.isFinished && (
)} {/* Series Badge (for series cards only) */} {seriesBadge && (
{seriesBadge}
)}
{/* Shelf Shadow */}
{/* Text Container - Fixed Height for Uniformity */}

{title}

{author}

); }