Improve video grid scrolling behavior when modal is open

Introduce a `hideScrollButtons` prop to `CategoryRow` in `netflix-grid.tsx` to conditionally render scroll buttons based on the `isModalOpen` state, preventing scroll button interference when a modal is active.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 074b0e4c-6171-43bd-aa98-f9e04623ca14
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/074b0e4c-6171-43bd-aa98-f9e04623ca14/DVZN4Rp
This commit is contained in:
sebastjanartic 2025-08-30 14:39:17 +00:00
parent 971f3aadb0
commit f10c46f0d8
2 changed files with 27 additions and 21 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View File

@ -111,6 +111,7 @@ export default function NetflixGrid({ videos, isLoading }: NetflixGridProps) {
<CategoryRow
category={category}
onVideoClick={handleVideoClick}
hideScrollButtons={isModalOpen}
/>
</div>
))}
@ -130,9 +131,10 @@ export default function NetflixGrid({ videos, isLoading }: NetflixGridProps) {
interface CategoryRowProps {
category: VideoCategory;
onVideoClick: (video: Video) => void;
hideScrollButtons?: boolean;
}
function CategoryRow({ category, onVideoClick }: CategoryRowProps) {
function CategoryRow({ category, onVideoClick, hideScrollButtons = false }: CategoryRowProps) {
const scrollRef = useRef<HTMLDivElement>(null);
const [isScrolling, setIsScrolling] = useState(false);
const scrollIntervalRef = useRef<NodeJS.Timeout>();
@ -195,27 +197,31 @@ function CategoryRow({ category, onVideoClick }: CategoryRowProps) {
{category.title}
</h2>
<div className="relative overflow-hidden">
{/* Left scroll button - only on desktop */}
<Button
onClick={() => scroll('left')}
onMouseEnter={() => startAutoScroll('left')}
onMouseLeave={stopAutoScroll}
className="absolute left-2 top-1/2 -translate-y-1/2 z-[60] bg-black/50 hover:bg-black/70 text-white border-none w-12 h-12 rounded-full transition-all duration-300 flex items-center justify-center shadow-xl hidden md:flex"
size="sm"
>
<ChevronLeft className="w-5 h-5" />
</Button>
{/* Left scroll button - only on desktop and not hidden */}
{!hideScrollButtons && (
<Button
onClick={() => scroll('left')}
onMouseEnter={() => startAutoScroll('left')}
onMouseLeave={stopAutoScroll}
className="absolute left-2 top-1/2 -translate-y-1/2 z-[60] bg-black/50 hover:bg-black/70 text-white border-none w-12 h-12 rounded-full transition-all duration-300 flex items-center justify-center shadow-xl hidden md:flex"
size="sm"
>
<ChevronLeft className="w-5 h-5" />
</Button>
)}
{/* Right scroll button - only on desktop */}
<Button
onClick={() => scroll('right')}
onMouseEnter={() => startAutoScroll('right')}
onMouseLeave={stopAutoScroll}
className="absolute right-2 top-1/2 -translate-y-1/2 z-[60] bg-black/50 hover:bg-black/70 text-white border-none w-12 h-12 rounded-full transition-all duration-300 flex items-center justify-center shadow-xl hidden md:flex"
size="sm"
>
<ChevronRight className="w-5 h-5" />
</Button>
{/* Right scroll button - only on desktop and not hidden */}
{!hideScrollButtons && (
<Button
onClick={() => scroll('right')}
onMouseEnter={() => startAutoScroll('right')}
onMouseLeave={stopAutoScroll}
className="absolute right-2 top-1/2 -translate-y-1/2 z-[60] bg-black/50 hover:bg-black/70 text-white border-none w-12 h-12 rounded-full transition-all duration-300 flex items-center justify-center shadow-xl hidden md:flex"
size="sm"
>
<ChevronRight className="w-5 h-5" />
</Button>
)}
{/* Scrollable video row - true edge to edge */}
<div