Adjust video scrolling speed to advance by four videos at once

Modify the scrolling behavior in the `CategoryRow` component to advance by a fixed number of videos (4) instead of a pixel-based speed, allowing users to skip multiple videos at once.

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 15:49:59 +00:00
parent e0875d514d
commit 80c9e87553

View File

@ -164,7 +164,9 @@ function CategoryRow({ category, onVideoClick }: CategoryRowProps) {
scrollIntervalRef.current = setInterval(() => {
setTranslateX(prev => {
const speed = direction === 'right' ? -baseSpeed : baseSpeed;
const videosPerStep = 4; // Move 4 videos at once
const adjustedSpeed = speedMode === 'fast' ? videosPerStep * videoWidth * 0.03 : videosPerStep * videoWidth * 0.01;
const speed = direction === 'right' ? -adjustedSpeed : adjustedSpeed;
const newX = prev + speed;
const totalWidth = category.videos.length * videoWidth;
@ -196,8 +198,9 @@ function CategoryRow({ category, onVideoClick }: CategoryRowProps) {
// Start continuous smooth scrolling with variable speed
scrollIntervalRef.current = setInterval(() => {
setTranslateX(prev => {
// Speed changes based on mode: normal (0.8px) or fast (2.5px)
const baseSpeed = speedMode === 'fast' ? 2.5 : 0.8;
// Speed changes based on mode: move by full videos (4 videos at once)
const videosPerStep = 4; // Move 4 videos at once
const baseSpeed = speedMode === 'fast' ? videosPerStep * videoWidth * 0.03 : videosPerStep * videoWidth * 0.01;
const speed = direction === 'right' ? -baseSpeed : baseSpeed;
const newX = prev + speed;
const totalWidth = category.videos.length * videoWidth;