From 534527d233f62144c9adea740fbc96ddcfc7dd92 Mon Sep 17 00:00:00 2001 From: sebastjanartic <45803536-sebastjanartic@users.noreply.replit.com> Date: Fri, 29 Aug 2025 14:23:14 +0000 Subject: [PATCH] Improve the video carousel scrolling and navigation experience Adjusts the scrolling behavior and replaces hover-activated scroll areas with dedicated buttons in the video carousel component to enhance usability on both desktop and mobile. 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/fgCGOr7 --- client/src/components/netflix-grid.tsx | 66 ++++++++++++-------------- 1 file changed, 30 insertions(+), 36 deletions(-) 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) {