Improve video recommendations and filtering logic for better content discovery

Update `VideoPage.tsx` to correctly filter recommended videos by excluding the current video's ID. Enhance category-based video filtering by using a temporary variable for the video title and safely accessing its properties.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 2cd2c0bc-434c-4bc9-ad3f-b99d3897a0d1
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/2cd2c0bc-434c-4bc9-ad3f-b99d3897a0d1/HCAS0JG
This commit is contained in:
sebastjanartic 2025-09-03 11:14:13 +00:00
parent dc20d4a07a
commit 46a4abd430
2 changed files with 13 additions and 11 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

View File

@ -76,7 +76,7 @@ export default function VideoPage() {
enabled: !!videoId,
});
const recommendedVideos = recommendedResponse?.videos?.filter(v => v.id !== videoId) || [];
const recommendedVideos = recommendedResponse?.videos?.filter(v => v.id !== currentVideo?.id) || [];
// Filter videos based on current video category for navigation
const getFilteredVideosForNavigation = () => {
@ -85,25 +85,27 @@ export default function VideoPage() {
// Check if current video belongs to a specific category
if (currentVideo.title.includes("FOLX STADL") || currentVideo.title.includes("FOLXSTADL")) {
const videoTitle = currentVideo.title || '';
if (videoTitle.includes("FOLX STADL") || videoTitle.includes("FOLXSTADL")) {
return allVideos.filter(video =>
video.title.includes("FOLX STADL") || video.title.includes("FOLXSTADL")
video.title?.includes("FOLX STADL") || video.title?.includes("FOLXSTADL")
);
}
if (currentVideo.title.includes("Gipfelstammtisch") ||
currentVideo.title.includes("GIPFELSTAMMTISCH") ||
currentVideo.title.includes("Gipfel Stammtisch")) {
if (videoTitle.includes("Gipfelstammtisch") ||
videoTitle.includes("GIPFELSTAMMTISCH") ||
videoTitle.includes("Gipfel Stammtisch")) {
return allVideos.filter(video =>
video.title.includes("Gipfelstammtisch") ||
video.title.includes("GIPFELSTAMMTISCH") ||
video.title.includes("Gipfel Stammtisch")
video.title?.includes("Gipfelstammtisch") ||
video.title?.includes("GIPFELSTAMMTISCH") ||
video.title?.includes("Gipfel Stammtisch")
);
}
if (currentVideo.title.includes("Geschichte des Liedes")) {
if (videoTitle.includes("Geschichte des Liedes")) {
const filtered = allVideos.filter(video =>
video.title.includes("Geschichte des Liedes")
video.title?.includes("Geschichte des Liedes")
);
return filtered;
}