import { Film, Tv, Music } from 'lucide-react';
import { cn } from '@/lib/utils';
interface MediaCardSmallProps {
title: string;
type: string;
showTitle?: string | null;
year?: number | null;
playCount: number;
thumbPath?: string | null;
serverId?: string | null;
rank?: number;
className?: string;
style?: React.CSSProperties;
/** For TV shows (aggregated series), number of unique episodes watched */
episodeCount?: number;
}
function MediaIcon({ type, className }: { type: string; className?: string }) {
switch (type) {
case 'movie':
return ;
case 'episode':
return ;
case 'track':
return ;
default:
return ;
}
}
function getImageUrl(serverId: string | null | undefined, thumbPath: string | null | undefined, width = 150, height = 225) {
if (!serverId || !thumbPath) return null;
return `/api/v1/images/proxy?server=${serverId}&url=${encodeURIComponent(thumbPath)}&width=${width}&height=${height}&fallback=poster`;
}
export function MediaCardSmall({
title,
type,
showTitle,
year,
playCount,
thumbPath,
serverId,
rank,
className,
style,
episodeCount,
}: MediaCardSmallProps) {
const imageUrl = getImageUrl(serverId, thumbPath);
// For individual episodes: showTitle is series name, title is episode name
// For aggregated shows: title is series name (no showTitle), episodeCount indicates it's aggregated
const displayTitle = type === 'episode' && showTitle ? showTitle : title;
return (
{/* Poster */}
{imageUrl ? (

) : (
)}
{/* Rank badge */}
{rank && (
{rank}
)}
{/* Hover overlay with play count */}
{/* Info */}
{displayTitle}
{episodeCount
? `${episodeCount} eps`
: type === 'episode'
? title
: year || type}
);
}