Improve navigation by allowing users to scroll through video categories

Update the netflix-grid component to fix the scrolling logic for video categories. The scrolling direction has been reversed, and the current index logic is now correctly handling wrapping around the list of videos.

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/QCN70f2
This commit is contained in:
sebastjanartic 2025-08-29 14:54:45 +00:00
parent bb57672a6f
commit dbaa3dbd6d

View File

@ -143,10 +143,12 @@ function CategoryRow({ category, onVideoClick }: CategoryRowProps) {
const scroll = (direction: 'left' | 'right') => { const scroll = (direction: 'left' | 'right') => {
const totalVideos = category.videos.length; const totalVideos = category.videos.length;
if (direction === 'left') { if (direction === 'right') {
setCurrentIndex(prev => prev === 0 ? totalVideos - 1 : prev - 1); // Move one video forward (shift left to show next video)
setCurrentIndex(prev => (prev + 1) % totalVideos);
} else { } else {
setCurrentIndex(prev => prev === totalVideos - 1 ? 0 : prev + 1); // Move one video backward (shift right to show previous video)
setCurrentIndex(prev => prev === 0 ? totalVideos - 1 : prev - 1);
} }
}; };