diff --git a/client/src/components/netflix-grid.tsx b/client/src/components/netflix-grid.tsx index bda81db..bda5228 100644 --- a/client/src/components/netflix-grid.tsx +++ b/client/src/components/netflix-grid.tsx @@ -157,20 +157,16 @@ function CategoryRow({ category, onVideoClick }: CategoryRowProps) { scroll(direction); }; - // Get visible videos based on current index - const getVisibleVideos = () => { + // Handle infinite scroll reset + useEffect(() => { const totalVideos = category.videos.length; - const visible = []; - - for (let i = 0; i < videosToShow; i++) { - const index = (currentIndex + i) % totalVideos; - visible.push({ - ...category.videos[index], - displayIndex: i - }); + if (currentIndex >= totalVideos) { + // Reset to beginning for infinite loop + setTimeout(() => { + setCurrentIndex(0); + }, 500); // After animation completes } - return visible; - }; + }, [currentIndex, category.videos.length]); // Always show both buttons useEffect(() => { @@ -271,11 +267,16 @@ function CategoryRow({ category, onVideoClick }: CategoryRowProps) { {/* Carousel video row */} -