From ff7660be82f8e24bd6f74a1a30c5e15f508e435e Mon Sep 17 00:00:00 2001 From: sebastjanartic <45803536-sebastjanartic@users.noreply.replit.com> Date: Sat, 30 Aug 2025 15:25:14 +0000 Subject: [PATCH] Organize recently added videos by performer for better browsing Adjust the "Recently Added" grid to filter videos from the "Geschichte des Liedes" collection, group them by performer, sort each group by upload date, and then distribute them by taking one from each performer per round to a maximum of 15 videos. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 074b0e4c-6171-43bd-aa98-f9e04623ca14 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/074b0e4c-6171-43bd-aa98-f9e04623ca14/DVZN4Rp --- client/src/components/netflix-grid.tsx | 39 +++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/client/src/components/netflix-grid.tsx b/client/src/components/netflix-grid.tsx index 327daad..863ad59 100644 --- a/client/src/components/netflix-grid.tsx +++ b/client/src/components/netflix-grid.tsx @@ -56,7 +56,44 @@ export default function NetflixGrid({ videos, isLoading }: NetflixGridProps) { }, { title: "Recently Added", - videos: sortedByDate.slice(0, 15) + videos: (() => { + // Filter videos from "Geschichte des Liedes" collection + const geschichteVideos = videos.filter(video => + video.title.includes("Geschichte des Liedes") + ); + + // Group by performer/artist (extract performer name before " - ") + const performerGroups: { [key: string]: typeof videos } = {}; + geschichteVideos.forEach(video => { + const performer = video.title.split(" - ")[0] || "Unknown"; + if (!performerGroups[performer]) { + performerGroups[performer] = []; + } + performerGroups[performer].push(video); + }); + + // Sort each group by upload date (newest first) + Object.keys(performerGroups).forEach(performer => { + performerGroups[performer].sort((a, b) => + new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime() + ); + }); + + // Distribute videos: first one from each performer, then continue + const result = []; + const performers = Object.keys(performerGroups); + let maxRounds = Math.max(...performers.map(p => performerGroups[p].length)); + + for (let round = 0; round < maxRounds && result.length < 15; round++) { + for (let performer of performers) { + if (performerGroups[performer][round] && result.length < 15) { + result.push(performerGroups[performer][round]); + } + } + } + + return result; + })() }, { title: "Trending Now",