diff --git a/client/src/components/netflix-grid.tsx b/client/src/components/netflix-grid.tsx index 08de1e2..581101c 100644 --- a/client/src/components/netflix-grid.tsx +++ b/client/src/components/netflix-grid.tsx @@ -1,4 +1,4 @@ -import { useState, useRef } from "react"; +import { useState, useRef, useEffect } from "react"; import { type Video } from "@shared/schema"; import VideoCard from "./video-card"; import BunnyVideoModal from "./bunny-video-modal"; @@ -133,6 +133,8 @@ interface CategoryRowProps { function CategoryRow({ category, onVideoClick }: CategoryRowProps) { const scrollRef = useRef(null); + const [isScrolling, setIsScrolling] = useState(false); + const scrollIntervalRef = useRef(); const scroll = (direction: 'left' | 'right') => { if (scrollRef.current) { @@ -152,6 +154,31 @@ function CategoryRow({ category, onVideoClick }: CategoryRowProps) { } }; + const startAutoScroll = (direction: 'left' | 'right') => { + setIsScrolling(true); + scrollIntervalRef.current = setInterval(() => { + if (scrollRef.current) { + const scrollStep = direction === 'left' ? -3 : 3; + scrollRef.current.scrollLeft += scrollStep; + } + }, 16); // 60fps smooth scrolling + }; + + const stopAutoScroll = () => { + setIsScrolling(false); + if (scrollIntervalRef.current) { + clearInterval(scrollIntervalRef.current); + } + }; + + useEffect(() => { + return () => { + if (scrollIntervalRef.current) { + clearInterval(scrollIntervalRef.current); + } + }; + }, []); + return (

@@ -159,23 +186,27 @@ function CategoryRow({ category, onVideoClick }: CategoryRowProps) {

- {/* Left scroll button */} - +
+ +
+
- {/* Right scroll button */} - +
+ +
+
{/* Scrollable video row - true edge to edge */}