'use client'; import { memo } from 'react'; import Link from 'next/link'; import Image from 'next/image'; import { Card } from '@/components/ui/Card'; import { Badge } from '@/components/ui/Badge'; import { Icons } from '@/components/ui/Icon'; import { LatencyBadge } from '@/components/ui/LatencyBadge'; import { FavoriteButton } from '@/components/favorites/FavoriteButton'; import { Video } from '@/lib/types'; import { parseVideoTitle } from '@/lib/utils/video'; interface VideoCardProps { video: Video; videoUrl: string; cardId: string; isActive: boolean; onCardClick: (e: React.MouseEvent, cardId: string, videoUrl: string) => void; isPremium?: boolean; } export const VideoCard = memo(({ video, videoUrl, cardId, isActive, onCardClick, isPremium = false }) => { return (
(e.currentTarget.style.zIndex = '100')} onMouseLeave={(e) => (e.currentTarget.style.zIndex = '1')} > onCardClick(e, cardId, videoUrl)} role="listitem" aria-label={`${video.vod_name}${video.vod_remarks ? ` - ${video.vod_remarks}` : ''}`} prefetch={false} className="group cursor-pointer hover:translate-y-[-2px] transition-transform duration-200 ease-out block h-full" > {/* Poster */}
{video.vod_pic ? ( {video.vod_name} { const target = e.currentTarget as HTMLImageElement; target.style.opacity = '0'; }} /> ) : (
)} {/* Fallback Icon */}
{/* Badge Container */}
{video.sourceName && ( {video.sourceName} )} {video.latency !== undefined && ( )}
{/* Favorite Button - Top Right */}
{/* Overlay */}
{isActive && (
再次点击播放 →
)} {video.type_name && ( {video.type_name} )} {video.vod_year && (
{video.vod_year}
)}
{/* Info */}
{(() => { const { cleanTitle, quality } = parseVideoTitle(video.vod_name); // Visual priority: Quality from title tag, then vod_remarks const displayQuality = quality || video.vod_remarks; return ( <>

{cleanTitle}

{displayQuality && (

{displayQuality}

)} {/* Hide remarks if it was used as quality to avoid duplication */} {video.vod_remarks && video.vod_remarks !== displayQuality && (

{video.vod_remarks}

)} ); })()}
); }); VideoCard.displayName = 'VideoCard';