From 5b26f41fa74bee66d1f074e8791719dbc524e03e Mon Sep 17 00:00:00 2001 From: sebastjanartic <45803536-sebastjanartic@users.noreply.replit.com> Date: Mon, 1 Sep 2025 21:58:03 +0000 Subject: [PATCH] Improve video navigation between related content within categories Refine video navigation logic in VideoPage.tsx to filter videos by category (Gipfelstammtisch, Geschichte des Liedes, FOLX STADL) ensuring correct swipe functionality and preventing navigation to unrelated videos. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 890577b1-c154-40a4-a177-a0c6d55320c3 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/890577b1-c154-40a4-a177-a0c6d55320c3/DyHCx4q --- client/src/pages/GeschichteLiedPage.tsx | 1 - client/src/pages/GipfelstammtischPage.tsx | 1 - client/src/pages/VideoPage.tsx | 39 ++++++++++++++++++++++- 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/client/src/pages/GeschichteLiedPage.tsx b/client/src/pages/GeschichteLiedPage.tsx index 88916d8..c9a1f66 100644 --- a/client/src/pages/GeschichteLiedPage.tsx +++ b/client/src/pages/GeschichteLiedPage.tsx @@ -55,7 +55,6 @@ export default function GeschichteLiedPage() { const handleTouchStart = (e: React.TouchEvent) => { setTouchEnd(0); setTouchStart(e.targetTouches[0].clientX); - console.log('Geschichte: Touch start, videos:', geschichteVideos.length, 'totalPages:', totalPages); }; const handleTouchMove = (e: React.TouchEvent) => { diff --git a/client/src/pages/GipfelstammtischPage.tsx b/client/src/pages/GipfelstammtischPage.tsx index e30a4d8..10e7c8e 100644 --- a/client/src/pages/GipfelstammtischPage.tsx +++ b/client/src/pages/GipfelstammtischPage.tsx @@ -55,7 +55,6 @@ export default function GipfelstammtischPage() { const handleTouchStart = (e: React.TouchEvent) => { setTouchEnd(0); setTouchStart(e.targetTouches[0].clientX); - console.log('Gipfel: Touch start, videos:', gipfelVideos.length, 'totalPages:', totalPages); }; const handleTouchMove = (e: React.TouchEvent) => { diff --git a/client/src/pages/VideoPage.tsx b/client/src/pages/VideoPage.tsx index 13aeb75..36faa02 100644 --- a/client/src/pages/VideoPage.tsx +++ b/client/src/pages/VideoPage.tsx @@ -76,7 +76,44 @@ export default function VideoPage() { }); const recommendedVideos = recommendedResponse?.videos?.filter(v => v.id !== videoId) || []; - const allVideos = recommendedResponse?.videos || []; + + // Filter videos based on current video category for navigation + const getFilteredVideosForNavigation = () => { + const allVideos = recommendedResponse?.videos || []; + if (!currentVideo) return allVideos; + + // Check if current video belongs to a specific category + if (currentVideo.title.includes("FOLX STADL") || currentVideo.title.includes("FOLXSTADL")) { + return allVideos.filter(video => + video.title.includes("FOLX STADL") || video.title.includes("FOLXSTADL") + ); + } + + if (currentVideo.title.includes("Gipfelstammtisch") || + currentVideo.title.includes("GIPFELSTAMMTISCH") || + currentVideo.title.includes("Gipfel Stammtisch")) { + return allVideos.filter(video => + video.title.includes("Gipfelstammtisch") || + video.title.includes("GIPFELSTAMMTISCH") || + video.title.includes("Gipfel Stammtisch") + ); + } + + if (currentVideo.title.includes("Die Geschichte des Liedes") || + currentVideo.title.includes("Geschichte des Liedes") || + currentVideo.title.includes("GESCHICHTE DES LIEDES")) { + return allVideos.filter(video => + video.title.includes("Die Geschichte des Liedes") || + video.title.includes("Geschichte des Liedes") || + video.title.includes("GESCHICHTE DES LIEDES") + ); + } + + // If not in any specific category, return all videos + return allVideos; + }; + + const allVideos = getFilteredVideosForNavigation(); // Navigation functions const getCurrentVideoIndex = () => {