feat(web-player): show YouTube Music albums in the explore search

The Albums chip now returns both your own albums and what YouTube Music has
for the term. A YouTube card opens a read-only album page with its cover,
tracklist and play button, and right-clicking a track still offers to add it
to a playlist through the existing menu.
This commit is contained in:
2026-07-20 20:39:21 +02:00
parent 07e1daf2ce
commit 78f7fe06cf
6 changed files with 408 additions and 18 deletions
@@ -0,0 +1,23 @@
import type { PageServerLoad, Actions } from './$types';
import { createApiClient, requireUser, unwrapOrError } from '$lib/server/api';
import { addYouTubeToPlaylistAction } from '$lib/server/playlistActions';
export const load: PageServerLoad = async ({ params, locals, url, fetch }) => {
const user = requireUser(locals, url);
const api = createApiClient({ fetch, accessToken: locals.accessToken ?? undefined });
const [albumRes, playlistsRes] = await Promise.all([
api.GET('/youtube/albums/{albumId}', { params: { path: { albumId: params.albumId } } }),
api.GET('/playlists/users/{userId}', {
params: { path: { userId: user.sub }, query: { pageNumber: 1, pageSize: 50 } }
})
]);
const album = unwrapOrError(albumRes, 'No se pudo cargar el álbum de YouTube Music.', 404);
return { album, playlists: playlistsRes.data?.items ?? [] };
};
export const actions: Actions = {
addYouTubeToPlaylist: addYouTubeToPlaylistAction
};