From ed3142e721e23a0acf1bdae952225e2bdb0c6b5e Mon Sep 17 00:00:00 2001 From: sebastjanartic <45803536-sebastjanartic@users.noreply.replit.com> Date: Fri, 29 Aug 2025 14:59:10 +0000 Subject: [PATCH] Improve video carousel scrolling with automatic hover activation Update the `CategoryRow` component in `netflix-grid.tsx` to implement continuous auto-scrolling of the video carousel when the user hovers over the scroll buttons. This includes clearing existing intervals and setting a new interval for automatic scrolling every 800ms, enhancing the user experience by making the carousel more interactive. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 2eb1084e-b728-4449-9231-f1665924c8d5 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/2eb1084e-b728-4449-9231-f1665924c8d5/QCN70f2 --- client/src/components/netflix-grid.tsx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/client/src/components/netflix-grid.tsx b/client/src/components/netflix-grid.tsx index 600418c..83025c8 100644 --- a/client/src/components/netflix-grid.tsx +++ b/client/src/components/netflix-grid.tsx @@ -151,8 +151,15 @@ function CategoryRow({ category, onVideoClick }: CategoryRowProps) { }; const startAutoScroll = (direction: 'left' | 'right') => { - // Just do single scroll on hover start - scroll(direction); + // Clear any existing interval + if (scrollIntervalRef.current) { + clearInterval(scrollIntervalRef.current); + } + + // Start continuous scrolling + scrollIntervalRef.current = setInterval(() => { + scroll(direction); + }, 800); // Auto scroll every 800ms }; // Initialize in middle section for true infinite scroll @@ -203,9 +210,11 @@ function CategoryRow({ category, onVideoClick }: CategoryRowProps) { }} onMouseEnter={(e) => { e.stopPropagation(); + startAutoScroll('left'); }} onMouseLeave={(e) => { e.stopPropagation(); + stopAutoScroll(); }} className="flex absolute left-2 top-[45%] -translate-y-1/2 w-12 h-12 z-30 bg-black/80 hover:bg-black/95 rounded-full items-center justify-center transition-all duration-300 cursor-pointer border border-white/30 shadow-lg opacity-0 group-hover:opacity-100 hover:!opacity-100" data-testid="button-scroll-left" @@ -222,9 +231,11 @@ function CategoryRow({ category, onVideoClick }: CategoryRowProps) { }} onMouseEnter={(e) => { e.stopPropagation(); + startAutoScroll('right'); }} onMouseLeave={(e) => { e.stopPropagation(); + stopAutoScroll(); }} className="flex absolute right-2 top-[45%] -translate-y-1/2 w-12 h-12 z-30 bg-black/80 hover:bg-black/95 rounded-full items-center justify-center transition-all duration-300 cursor-pointer border border-white/30 shadow-lg opacity-0 group-hover:opacity-100 hover:!opacity-100" data-testid="button-scroll-right"