feat(home): add Qobuz discover playlists section with tag filter
- Add backend endpoint for /discover/playlists API - Add PlaylistTagFilter dropdown component for filtering by genre - Add QobuzPlaylistCard with CSS blur background effect (color-thief style) - Add HorizontalScrollRow header snippet for custom headers with scroll controls - Add session cache store for caching API responses - Add i18n keys for playlist filter and discover section cc
This commit is contained in:
1 parent
9341e9ee19
commit
deaffa183d
15 files changed
+1608
-63
No files matched your search
@@ -12,6 +12,8 @@ export type HomeSectionId =
|
||||
| 'mostStreamed'
|
||||
| 'qobuzissimes'
|
||||
| 'editorPicks'
|
||||
| 'qobuzPlaylists'
|
||||
| 'essentialDiscography'
|
||||
| 'recentAlbums'
|
||||
| 'continueTracks'
|
||||
| 'topArtists'
|
||||
@@ -50,6 +52,8 @@ const DEFAULT_SECTIONS: HomeSection[] = [
|
||||
{ id: 'mostStreamed', label: 'Popular Albums', visible: false, source: 'qobuz' },
|
||||
{ id: 'qobuzissimes', label: 'Qobuzissimes', visible: false, source: 'qobuz' },
|
||||
{ id: 'editorPicks', label: "Editor's Picks", visible: false, source: 'qobuz' },
|
||||
{ id: 'qobuzPlaylists', label: 'Qobuz Playlists', visible: true, source: 'qobuz' },
|
||||
{ id: 'essentialDiscography', label: 'Essential Discography', visible: true, source: 'qobuz' },
|
||||
{ id: 'recentAlbums', label: 'Recently Played', visible: true, source: 'ml' },
|
||||
{ id: 'continueTracks', label: 'Continue Listening', visible: true, source: 'ml' },
|
||||
{ id: 'topArtists', label: 'Your Top Artists', visible: true, source: 'ml' },
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* In-memory session cache for API responses.
|
||||
* Data is cached for the lifetime of the app session (cleared on app close).
|
||||
* This avoids repeated API calls for the same data during a session.
|
||||
*/
|
||||
|
||||
import type { QobuzArtist, QobuzAlbum, QobuzTrack } from '$lib/types';
|
||||
|
||||
// Artist cache by ID
|
||||
const artistCache = new Map<number, QobuzArtist>();
|
||||
|
||||
// Album cache by ID
|
||||
const albumCache = new Map<string, QobuzAlbum>();
|
||||
|
||||
// Track cache by ID
|
||||
const trackCache = new Map<number, QobuzTrack>();
|
||||
|
||||
export function getCachedArtist(artistId: number): QobuzArtist | undefined {
|
||||
return artistCache.get(artistId);
|
||||
}
|
||||
|
||||
export function setCachedArtist(artist: QobuzArtist): void {
|
||||
artistCache.set(artist.id, artist);
|
||||
}
|
||||
|
||||
export function getCachedAlbum(albumId: string): QobuzAlbum | undefined {
|
||||
return albumCache.get(albumId);
|
||||
}
|
||||
|
||||
export function setCachedAlbum(album: QobuzAlbum): void {
|
||||
albumCache.set(album.id, album);
|
||||
}
|
||||
|
||||
export function getCachedTrack(trackId: number): QobuzTrack | undefined {
|
||||
return trackCache.get(trackId);
|
||||
}
|
||||
|
||||
export function setCachedTrack(track: QobuzTrack): void {
|
||||
trackCache.set(track.id, track);
|
||||
}
|
||||
|
||||
// Clear all caches (useful for logout or refresh)
|
||||
export function clearSessionCache(): void {
|
||||
artistCache.clear();
|
||||
albumCache.clear();
|
||||
trackCache.clear();
|
||||
}
|
||||
|
||||
// Get cache stats (for debugging)
|
||||
export function getCacheStats(): { artists: number; albums: number; tracks: number } {
|
||||
return {
|
||||
artists: artistCache.size,
|
||||
albums: albumCache.size,
|
||||
tracks: trackCache.size
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user