From 8fea0f2c764d832fb1ea6c263d85ed935769b33d Mon Sep 17 00:00:00 2001 From: sebastjanartic <45803536-sebastjanartic@users.noreply.replit.com> Date: Fri, 29 Aug 2025 10:27:30 +0000 Subject: [PATCH] Enable automatic scrolling of video rows on hover Implement automatic left and right scrolling for video rows when the mouse hovers over designated areas, replacing the previous click-based navigation buttons with a more intuitive hover-activated system. 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/P3O2FU7 --- client/src/components/netflix-grid.tsx | 58 ++++++++++++++++++-------- 1 file changed, 41 insertions(+), 17 deletions(-) diff --git a/client/src/components/netflix-grid.tsx b/client/src/components/netflix-grid.tsx index a4744a7..c33c3f7 100644 --- a/client/src/components/netflix-grid.tsx +++ b/client/src/components/netflix-grid.tsx @@ -133,6 +133,7 @@ interface CategoryRowProps { function CategoryRow({ category, onVideoClick }: CategoryRowProps) { const scrollRef = useRef(null); + const scrollIntervalRef = useRef(null); const scroll = (direction: 'left' | 'right') => { if (scrollRef.current) { @@ -153,39 +154,62 @@ function CategoryRow({ category, onVideoClick }: CategoryRowProps) { } }; + const startAutoScroll = (direction: 'left' | 'right') => { + if (scrollIntervalRef.current) { + clearInterval(scrollIntervalRef.current); + } + scrollIntervalRef.current = setInterval(() => { + if (scrollRef.current) { + const scrollAmount = direction === 'left' ? -3 : 3; + scrollRef.current.scrollLeft += scrollAmount; + } + }, 16); // ~60fps + }; + + const stopAutoScroll = () => { + if (scrollIntervalRef.current) { + clearInterval(scrollIntervalRef.current); + scrollIntervalRef.current = null; + } + }; + return (

{category.title}

-
- {/* Left scroll button - only on desktop */} - +
+ +
+
- {/* Right scroll button - only on desktop */} - +
+ +
+
{/* Mobile touch areas for left/right navigation */}
scroll('left')} />
scroll('right')} /> - {/* Scrollable video row */} + {/* Scrollable video row - edge to edge */}