import Link from 'next/link'; interface VideoData { id: string; title: string; uploader: string; channel_id?: string; thumbnail: string; view_count: number; duration: string; uploaded_date?: string; } function formatViews(views: number): string { if (views >= 1000000) return (views / 1000000).toFixed(1) + 'M'; if (views >= 1000) return (views / 1000).toFixed(1) + 'K'; return views.toString(); } function getRelativeTime(id: string): string { const times = ['2 hours ago', '5 hours ago', '1 day ago', '3 days ago', '1 week ago', '2 weeks ago', '1 month ago']; const index = (id.charCodeAt(0) || 0) % times.length; return times[index]; } export default function VideoCard({ video, hideChannelAvatar }: { video: VideoData; hideChannelAvatar?: boolean }) { const relativeTime = video.uploaded_date || getRelativeTime(video.id); return (
{/* eslint-disable-next-line @next/next/no-img-element */} {video.title} {video.duration && (
{video.duration}
)}
{/* Video Info */}

{video.title}

{video.channel_id ? ( {video.uploader} ) : (
{video.uploader}
)}
{formatViews(video.view_count)} views • {relativeTime}
); }