diff --git a/client/src/components/netflix-grid.tsx b/client/src/components/netflix-grid.tsx index 037c5f4..223dae3 100644 --- a/client/src/components/netflix-grid.tsx +++ b/client/src/components/netflix-grid.tsx @@ -144,9 +144,21 @@ function CategoryRow({ category, onVideoClick }: CategoryRowProps) { const videoWidth = 120; // Width including spacing const scroll = (direction: 'left' | 'right') => { - // Simple step movement + // Simple step movement with wrap-around logic const step = direction === 'right' ? -200 : 200; - setTranslateX(prev => prev + step); + setTranslateX(prev => { + const newX = prev + step; + const maxWidth = category.videos.length * 220; // Approximate video width + + // Wrap around logic for infinite scroll + if (direction === 'right' && newX < -maxWidth) { + return 0; // Reset to start when going too far right + } else if (direction === 'left' && newX > 0) { + return -maxWidth + 800; // Jump to end when going too far left + } + + return newX; + }); }; const toggleSpeed = (direction: 'left' | 'right') => { @@ -333,7 +345,7 @@ function CategoryRow({ category, onVideoClick }: CategoryRowProps) { className="flex space-x-4 pb-4" style={{ transform: `translateX(${translateX}px)`, - transition: 'transform 0.3s ease' + willChange: 'transform' }} > {/* Simple list to test movement */}