diff --git a/client/src/components/netflix-grid.tsx b/client/src/components/netflix-grid.tsx index 9adbb9e..398ff60 100644 --- a/client/src/components/netflix-grid.tsx +++ b/client/src/components/netflix-grid.tsx @@ -139,24 +139,16 @@ function CategoryRow({ category, onVideoClick }: CategoryRowProps) { if (scrollRef.current) { const isMobile = window.innerWidth < 768; const containerWidth = scrollRef.current.clientWidth; - const scrollAmount = isMobile ? containerWidth * 1.2 : containerWidth * 1.0; + const scrollAmount = isMobile ? containerWidth * 0.8 : containerWidth * 0.6; const currentScroll = scrollRef.current.scrollLeft; const maxScroll = scrollRef.current.scrollWidth - scrollRef.current.clientWidth; let targetScroll; if (direction === 'left') { - targetScroll = currentScroll - scrollAmount; - if (targetScroll <= 0) { - // Jump to end for infinite loop - targetScroll = maxScroll; - } + targetScroll = Math.max(0, currentScroll - scrollAmount); } else { - targetScroll = currentScroll + scrollAmount; - if (targetScroll >= maxScroll) { - // Jump to beginning for infinite loop - targetScroll = 0; - } + targetScroll = Math.min(maxScroll, currentScroll + scrollAmount); } scrollRef.current.scrollTo({ @@ -209,41 +201,43 @@ function CategoryRow({ category, onVideoClick }: CategoryRowProps) {
- {/* Left scroll area with transparent background - only on desktop */} -
scroll('left')} onMouseEnter={() => startAutoScroll('left')} onMouseLeave={stopAutoScroll} - onClick={() => scroll('left')} - className="hidden md:block absolute left-0 top-0 w-16 h-full z-30 bg-black/20 opacity-0 group-hover:opacity-100 transition-all duration-300 cursor-pointer" + className="hidden md:flex absolute left-2 top-1/2 -translate-y-1/2 w-12 h-12 z-30 bg-black/70 hover:bg-black/90 rounded-full items-center justify-center transition-all duration-300 cursor-pointer border border-white/20" + data-testid="button-scroll-left" > -
- -
-
+ + - {/* Right scroll area with transparent background - only on desktop */} -
scroll('right')} onMouseEnter={() => startAutoScroll('right')} onMouseLeave={stopAutoScroll} - onClick={() => scroll('right')} - className="hidden md:block absolute right-0 top-0 w-16 h-full z-30 bg-black/20 opacity-0 group-hover:opacity-100 transition-all duration-300 cursor-pointer" + className="hidden md:flex absolute right-2 top-1/2 -translate-y-1/2 w-12 h-12 z-30 bg-black/70 hover:bg-black/90 rounded-full items-center justify-center transition-all duration-300 cursor-pointer border border-white/20" + data-testid="button-scroll-right" > -
- -
-
+ + - {/* Mobile touch areas for left/right navigation */} -
scroll('left')} - style={{ touchAction: 'manipulation' }} - /> -
+ + + {/* Scrollable video row - edge to edge */}