import { Play, Info } from 'lucide-react'; import { useState, useRef } from 'react'; import { formatImageUrl } from '../lib/image'; export default function TopTenCard({ movie, index }) { const [showPreview, setShowPreview] = useState(false); const hoverTimer = useRef(null); const handleMouseEnter = () => { hoverTimer.current = setTimeout(() => { setShowPreview(true); }, 400); // Mượt mà hơn với 400ms phản hồi }; const handleMouseLeave = () => { if (hoverTimer.current) clearTimeout(hoverTimer.current); setShowPreview(false); }; const year = movie.year || (movie.modified?.time ? new Date(movie.modified.time).getFullYear() : ''); const epCount = movie.episode_current?.match(/\d+/)?.[0] || '??'; // horizontal backdrop for preview const backdrop = formatImageUrl(movie.poster_url || movie.thumb_url); const poster = formatImageUrl(movie.thumb_url || movie.poster_url); return (
{movie.origin_name}
{movie.content?.replace(/<[^>]*>/g, '') || 'Đang cập nhật nội dung cốt truyện...'}