From 50248cf16529e567ffef6a078c7f235197b2e2ed Mon Sep 17 00:00:00 2001 From: Khoa Vo Date: Thu, 1 Jan 2026 15:16:49 +0700 Subject: [PATCH] fix: duplicate React keys, update meta tags, improve mobile card layout --- frontend/app/layout.tsx | 3 ++ frontend/app/page.tsx | 48 ++++++++++++++--------------- frontend/context/LibraryContext.tsx | 9 +++++- 3 files changed, 35 insertions(+), 25 deletions(-) diff --git a/frontend/app/layout.tsx b/frontend/app/layout.tsx index a5e6493..545ea2a 100644 --- a/frontend/app/layout.tsx +++ b/frontend/app/layout.tsx @@ -24,6 +24,9 @@ export const metadata: Metadata = { statusBarStyle: "black-translucent", title: "Audiophile Web Player", }, + other: { + "mobile-web-app-capable": "yes", + }, icons: { icon: "/icons/icon-192x192.png", apple: "/icons/icon-512x512.png", diff --git a/frontend/app/page.tsx b/frontend/app/page.tsx index a502e27..c3affbc 100644 --- a/frontend/app/page.tsx +++ b/frontend/app/page.tsx @@ -180,25 +180,25 @@ export default function Home() { -
+
{sortPlaylists(playlists).slice(0, 5).map((playlist: any) => ( -
-
+
+
-
-
- +
+
+
-

{playlist.title}

-

{playlist.description}

+

{playlist.title}

+

{playlist.description}

))} @@ -314,24 +314,24 @@ function MadeForYouSection() { ))}
) : ( -
+
{recommendations.slice(0, 5).map((track, i) => ( -
playTrack(track, recommendations)} className="bg-[#181818] p-4 rounded-md hover:bg-[#282828] transition duration-300 group cursor-pointer relative h-full flex flex-col"> -
+
playTrack(track, recommendations)} className="bg-[#181818] p-2 md:p-4 rounded-md hover:bg-[#282828] transition duration-300 group cursor-pointer relative h-full flex flex-col"> +
-
-
- +
+
+
-

{track.title}

-

{track.artist}

+

{track.title}

+

{track.artist}

))}
@@ -388,24 +388,24 @@ function RecommendedAlbumsSection() { ))}
) : ( -
+
{albums.slice(0, 5).map((album, i) => ( -
-
+
+
-
-
- +
+
+
-

{album.title}

-

{album.description}

+

{album.title}

+

{album.description}

))} diff --git a/frontend/context/LibraryContext.tsx b/frontend/context/LibraryContext.tsx index 289d5db..7507037 100644 --- a/frontend/context/LibraryContext.tsx +++ b/frontend/context/LibraryContext.tsx @@ -30,7 +30,14 @@ export function LibraryProvider({ children }: { children: React.ReactNode }) { // 2. Local/Backend Content const browse = await libraryService.getBrowseContent(); - const browsePlaylists = Object.values(browse).flat(); + // Deduplicate by ID to avoid React duplicate key warnings + const browsePlaylistsRaw = Object.values(browse).flat(); + const seenIds = new Map(); + const browsePlaylists = browsePlaylistsRaw.filter((p: any) => { + if (seenIds.has(p.id)) return false; + seenIds.set(p.id, true); + return true; + }); const artistsMap = new Map(); const albumsMap = new Map();