feat: add discover browse pages for New Releases, Ideal Discography, Top Albums
Add full-page browsing views for the three discover sections that were previously only shown as limited carousels on the Home page. Backend: add get_discover_albums Tauri command with endpoints for newReleases, idealDiscography, and mostStreamed. Uses paginated API calls with genre_ids filtering. Frontend: new DiscoverBrowseView component with virtualized grid/list, genre filter dropdown, client-side search, and infinite scroll. VirtualizedFavoritesAlbumGrid gains ranking support (showRanking), infinite scroll (onLoadMore), and loading indicator. HomeView sections now show "See All" links that navigate to the dedicated browse pages. i18n keys added to all 4 locales.
This commit is contained in:
1 parent
ed06a397ef
commit
c9bdcae855
13 files changed
+859
-33
No files matched your search
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { onMount, onDestroy } from 'svelte';
|
||||
import { t } from '$lib/i18n';
|
||||
import { Disc3 } from 'lucide-svelte';
|
||||
import { Disc3, Loader2 } from 'lucide-svelte';
|
||||
import AlbumCard from './AlbumCard.svelte';
|
||||
import QualityBadge from './QualityBadge.svelte';
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
|
||||
type VirtualItem =
|
||||
| { type: 'header'; key: string; id: string; albumCount: number; height: number }
|
||||
| { type: 'grid-row'; albums: FavoriteAlbum[]; height: number }
|
||||
| { type: 'list-row'; album: FavoriteAlbum; height: number };
|
||||
| { type: 'grid-row'; albums: FavoriteAlbum[]; startIndex: number; height: number }
|
||||
| { type: 'list-row'; album: FavoriteAlbum; globalIndex: number; height: number };
|
||||
|
||||
interface Props {
|
||||
groups: AlbumGroup[];
|
||||
@@ -48,6 +48,10 @@
|
||||
getQualityLabel?: (item: { hires?: boolean; maximum_bit_depth?: number; maximum_sampling_rate?: number }) => string;
|
||||
getGenreLabel?: (album: FavoriteAlbum) => string;
|
||||
getAlbumYear?: (album: FavoriteAlbum) => string | null;
|
||||
showRanking?: boolean;
|
||||
onLoadMore?: () => void;
|
||||
isLoadingMore?: boolean;
|
||||
onAddAlbumToPlaylist?: (albumId: string) => void;
|
||||
}
|
||||
|
||||
let {
|
||||
@@ -70,6 +74,10 @@
|
||||
getQualityLabel,
|
||||
getGenreLabel,
|
||||
getAlbumYear,
|
||||
showRanking = false,
|
||||
onLoadMore,
|
||||
isLoadingMore = false,
|
||||
onAddAlbumToPlaylist,
|
||||
}: Props = $props();
|
||||
|
||||
// Constants
|
||||
@@ -98,6 +106,7 @@
|
||||
let virtualItems = $derived.by(() => {
|
||||
const items: (VirtualItem & { top: number; groupId?: string })[] = [];
|
||||
let currentTop = 0;
|
||||
let albumIndex = 0;
|
||||
|
||||
for (const group of groups) {
|
||||
if (showGroupHeaders && group.key) {
|
||||
@@ -121,20 +130,24 @@
|
||||
items.push({
|
||||
type: 'grid-row',
|
||||
albums: rowAlbums,
|
||||
startIndex: albumIndex + i,
|
||||
height: GRID_CARD_HEIGHT,
|
||||
top: currentTop,
|
||||
});
|
||||
currentTop += rowHeight;
|
||||
}
|
||||
albumIndex += group.albums.length;
|
||||
} else {
|
||||
const rowHeight = LIST_ROW_HEIGHT + LIST_ROW_GAP;
|
||||
for (const album of group.albums) {
|
||||
items.push({
|
||||
type: 'list-row',
|
||||
album,
|
||||
globalIndex: albumIndex,
|
||||
height: LIST_ROW_HEIGHT,
|
||||
top: currentTop,
|
||||
});
|
||||
albumIndex++;
|
||||
currentTop += rowHeight;
|
||||
}
|
||||
}
|
||||
@@ -216,7 +229,16 @@
|
||||
});
|
||||
|
||||
function handleScroll(e: Event) {
|
||||
scrollTop = (e.target as HTMLDivElement).scrollTop;
|
||||
const el = e.target as HTMLDivElement;
|
||||
scrollTop = el.scrollTop;
|
||||
|
||||
// Infinite scroll: fire onLoadMore when near bottom
|
||||
if (onLoadMore && !isLoadingMore) {
|
||||
const distanceFromBottom = el.scrollHeight - el.scrollTop - el.clientHeight;
|
||||
if (distanceFromBottom < 300) {
|
||||
onLoadMore();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let resizeObserver: ResizeObserver | null = null;
|
||||
@@ -283,33 +305,42 @@
|
||||
</div>
|
||||
{:else if item.type === 'grid-row'}
|
||||
<div class="album-grid-row">
|
||||
{#each item.albums as album (album.id)}
|
||||
<AlbumCard
|
||||
albumId={album.id}
|
||||
artwork={album.image?.large || album.image?.thumbnail || ''}
|
||||
title={album.title}
|
||||
artist={album.artist.name}
|
||||
genre={getGenreLabel?.(album) ?? album.genre?.name ?? ''}
|
||||
releaseDate={album.release_date_original}
|
||||
size="large"
|
||||
quality={getQualityLabel?.(album) ?? ''}
|
||||
onPlay={onAlbumPlay ? () => onAlbumPlay(album.id) : undefined}
|
||||
onPlayNext={onAlbumPlayNext ? () => onAlbumPlayNext(album.id) : undefined}
|
||||
onPlayLater={onAlbumPlayLater ? () => onAlbumPlayLater(album.id) : undefined}
|
||||
onShareQobuz={onAlbumShareQobuz ? () => onAlbumShareQobuz(album.id) : undefined}
|
||||
onShareSonglink={onAlbumShareSonglink ? () => onAlbumShareSonglink(album.id) : undefined}
|
||||
onDownload={onAlbumDownload ? () => onAlbumDownload(album.id) : undefined}
|
||||
isAlbumFullyDownloaded={isAlbumDownloaded?.(album.id) ?? false}
|
||||
onOpenContainingFolder={onOpenAlbumFolder ? () => onOpenAlbumFolder(album.id) : undefined}
|
||||
onReDownloadAlbum={onReDownloadAlbum ? () => onReDownloadAlbum(album.id) : undefined}
|
||||
{downloadStateVersion}
|
||||
onclick={() => handleAlbumClickEvent(album.id)}
|
||||
/>
|
||||
{#each item.albums as album, idx (album.id)}
|
||||
<div class="grid-card-wrapper">
|
||||
{#if showRanking}
|
||||
<div class="rank-badge">#{item.startIndex + idx + 1}</div>
|
||||
{/if}
|
||||
<AlbumCard
|
||||
albumId={album.id}
|
||||
artwork={album.image?.large || album.image?.thumbnail || ''}
|
||||
title={album.title}
|
||||
artist={album.artist.name}
|
||||
genre={getGenreLabel?.(album) ?? album.genre?.name ?? ''}
|
||||
releaseDate={album.release_date_original}
|
||||
size="large"
|
||||
quality={getQualityLabel?.(album) ?? ''}
|
||||
onPlay={onAlbumPlay ? () => onAlbumPlay(album.id) : undefined}
|
||||
onPlayNext={onAlbumPlayNext ? () => onAlbumPlayNext(album.id) : undefined}
|
||||
onPlayLater={onAlbumPlayLater ? () => onAlbumPlayLater(album.id) : undefined}
|
||||
onAddAlbumToPlaylist={onAddAlbumToPlaylist ? () => onAddAlbumToPlaylist(album.id) : undefined}
|
||||
onShareQobuz={onAlbumShareQobuz ? () => onAlbumShareQobuz(album.id) : undefined}
|
||||
onShareSonglink={onAlbumShareSonglink ? () => onAlbumShareSonglink(album.id) : undefined}
|
||||
onDownload={onAlbumDownload ? () => onAlbumDownload(album.id) : undefined}
|
||||
isAlbumFullyDownloaded={isAlbumDownloaded?.(album.id) ?? false}
|
||||
onOpenContainingFolder={onOpenAlbumFolder ? () => onOpenAlbumFolder(album.id) : undefined}
|
||||
onReDownloadAlbum={onReDownloadAlbum ? () => onReDownloadAlbum(album.id) : undefined}
|
||||
{downloadStateVersion}
|
||||
onclick={() => handleAlbumClickEvent(album.id)}
|
||||
/>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
{:else if item.type === 'list-row'}
|
||||
{@const album = item.album}
|
||||
<div class="album-row" role="button" tabindex="0" onclick={() => handleAlbumClickEvent(album.id)}>
|
||||
<div class="album-row" class:has-rank={showRanking} role="button" tabindex="0" onclick={() => handleAlbumClickEvent(album.id)}>
|
||||
{#if showRanking}
|
||||
<div class="rank-number">#{item.globalIndex + 1}</div>
|
||||
{/if}
|
||||
<div class="album-row-art">
|
||||
{#if album.image?.thumbnail || album.image?.small || album.image?.large}
|
||||
<img src={album.image?.thumbnail || album.image?.small || album.image?.large} alt={album.title} loading="lazy" decoding="async" />
|
||||
@@ -338,6 +369,12 @@
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
{#if isLoadingMore}
|
||||
<div class="loading-more">
|
||||
<Loader2 size={20} class="spin" />
|
||||
<span>{$t('discover.loadingMore')}</span>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
@@ -479,4 +516,56 @@
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
/* Ranking styles */
|
||||
.grid-card-wrapper {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.rank-badge {
|
||||
position: absolute;
|
||||
top: 4px;
|
||||
left: 4px;
|
||||
z-index: 2;
|
||||
background: rgba(0, 0, 0, 0.75);
|
||||
color: #fff;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
padding: 2px 6px;
|
||||
border-radius: 6px;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.rank-number {
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: var(--text-muted);
|
||||
min-width: 36px;
|
||||
text-align: right;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.album-row.has-rank {
|
||||
grid-template-columns: 36px 56px 1fr auto;
|
||||
}
|
||||
|
||||
/* Loading more spinner */
|
||||
.loading-more {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
padding: 24px 0;
|
||||
color: var(--text-muted);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.loading-more :global(.spin) {
|
||||
animation: spin 1s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
from { transform: rotate(0deg); }
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,519 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { invoke } from '@tauri-apps/api/core';
|
||||
import { t } from '$lib/i18n';
|
||||
import { ChevronLeft, Search, LayoutGrid, List, X } from 'lucide-svelte';
|
||||
import VirtualizedFavoritesAlbumGrid from '../VirtualizedFavoritesAlbumGrid.svelte';
|
||||
|
||||
interface DiscoverAlbum {
|
||||
id: string;
|
||||
title: string;
|
||||
version?: string;
|
||||
track_count?: number;
|
||||
duration?: number;
|
||||
image: { small?: string; thumbnail?: string; large?: string };
|
||||
artists: { id: number; name: string; roles?: string[] }[];
|
||||
label?: { id: number; name: string };
|
||||
genre?: { id: number; name: string };
|
||||
dates?: { download?: string; original?: string; stream?: string };
|
||||
audio_info?: { maximum_sampling_rate?: number; maximum_bit_depth?: number; maximum_channel_count?: number };
|
||||
}
|
||||
|
||||
interface DiscoverAlbumsResponse {
|
||||
has_more: boolean;
|
||||
items: DiscoverAlbum[];
|
||||
}
|
||||
|
||||
interface FavoriteAlbum {
|
||||
id: string;
|
||||
title: string;
|
||||
artist: { id: number; name: string };
|
||||
genre?: { name: string };
|
||||
image: { small?: string; thumbnail?: string; large?: string };
|
||||
release_date_original?: string;
|
||||
hires: boolean;
|
||||
maximum_bit_depth?: number;
|
||||
maximum_sampling_rate?: number;
|
||||
}
|
||||
|
||||
interface GenreInfo {
|
||||
id: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
interface Props {
|
||||
endpointType: 'newReleases' | 'idealDiscography' | 'mostStreamed';
|
||||
titleKey: string;
|
||||
showRanking?: boolean;
|
||||
onBack: () => void;
|
||||
onAlbumClick?: (albumId: string) => void;
|
||||
onAlbumPlay?: (albumId: string) => void;
|
||||
onAlbumPlayNext?: (albumId: string) => void;
|
||||
onAlbumPlayLater?: (albumId: string) => void;
|
||||
onAlbumShareQobuz?: (albumId: string) => void;
|
||||
onAlbumShareSonglink?: (albumId: string) => void;
|
||||
onAlbumDownload?: (albumId: string) => void;
|
||||
onOpenAlbumFolder?: (albumId: string) => void;
|
||||
onReDownloadAlbum?: (albumId: string) => void;
|
||||
onAddAlbumToPlaylist?: (albumId: string) => void;
|
||||
checkAlbumFullyDownloaded?: (albumId: string) => Promise<boolean>;
|
||||
downloadStateVersion?: number;
|
||||
onArtistClick?: (artistId: number) => void;
|
||||
}
|
||||
|
||||
let {
|
||||
endpointType,
|
||||
titleKey,
|
||||
showRanking = false,
|
||||
onBack,
|
||||
onAlbumClick,
|
||||
onAlbumPlay,
|
||||
onAlbumPlayNext,
|
||||
onAlbumPlayLater,
|
||||
onAlbumShareQobuz,
|
||||
onAlbumShareSonglink,
|
||||
onAlbumDownload,
|
||||
onOpenAlbumFolder,
|
||||
onReDownloadAlbum,
|
||||
onAddAlbumToPlaylist,
|
||||
checkAlbumFullyDownloaded,
|
||||
downloadStateVersion,
|
||||
onArtistClick,
|
||||
}: Props = $props();
|
||||
|
||||
const PAGE_SIZE = 50;
|
||||
|
||||
// State
|
||||
let albums = $state<FavoriteAlbum[]>([]);
|
||||
let hasMore = $state(true);
|
||||
let offset = $state(0);
|
||||
let isLoading = $state(false);
|
||||
let isLoadingMore = $state(false);
|
||||
let searchQuery = $state('');
|
||||
let viewMode = $state<'grid' | 'list'>('grid');
|
||||
let genres = $state<GenreInfo[]>([]);
|
||||
let selectedGenreId = $state<number | null>(null);
|
||||
let albumDownloadStatuses = $state<Map<string, boolean>>(new Map());
|
||||
|
||||
// Search filter (client-side on loaded items)
|
||||
function getFilteredAlbums(): FavoriteAlbum[] {
|
||||
if (!searchQuery.trim()) return albums;
|
||||
const q = searchQuery.toLowerCase();
|
||||
return albums.filter(
|
||||
(album) =>
|
||||
album.title.toLowerCase().includes(q) ||
|
||||
album.artist.name.toLowerCase().includes(q)
|
||||
);
|
||||
}
|
||||
|
||||
function isAlbumDownloaded(albumId: string): boolean {
|
||||
return albumDownloadStatuses.get(albumId) ?? false;
|
||||
}
|
||||
|
||||
async function loadAlbumDownloadStatuses(albumList: FavoriteAlbum[]) {
|
||||
if (!checkAlbumFullyDownloaded) return;
|
||||
for (const album of albumList) {
|
||||
if (!albumDownloadStatuses.has(album.id)) {
|
||||
try {
|
||||
const downloaded = await checkAlbumFullyDownloaded(album.id);
|
||||
albumDownloadStatuses.set(album.id, downloaded);
|
||||
albumDownloadStatuses = new Map(albumDownloadStatuses);
|
||||
} catch {
|
||||
// Ignore errors
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function discoverToFavorite(item: DiscoverAlbum): FavoriteAlbum {
|
||||
const bitDepth = item.audio_info?.maximum_bit_depth ?? 16;
|
||||
return {
|
||||
id: item.id,
|
||||
title: item.title,
|
||||
artist: {
|
||||
id: item.artists?.[0]?.id ?? 0,
|
||||
name: item.artists?.[0]?.name ?? 'Unknown Artist',
|
||||
},
|
||||
genre: item.genre ? { name: item.genre.name } : undefined,
|
||||
image: {
|
||||
small: item.image?.small,
|
||||
thumbnail: item.image?.thumbnail,
|
||||
large: item.image?.large,
|
||||
},
|
||||
release_date_original: item.dates?.original,
|
||||
hires: bitDepth > 16,
|
||||
maximum_bit_depth: item.audio_info?.maximum_bit_depth,
|
||||
maximum_sampling_rate: item.audio_info?.maximum_sampling_rate,
|
||||
};
|
||||
}
|
||||
|
||||
async function fetchAlbums(resetData: boolean = false) {
|
||||
if (resetData) {
|
||||
offset = 0;
|
||||
albums = [];
|
||||
hasMore = true;
|
||||
isLoading = true;
|
||||
} else {
|
||||
isLoadingMore = true;
|
||||
}
|
||||
|
||||
try {
|
||||
const genreIds = selectedGenreId ? [selectedGenreId] : undefined;
|
||||
const response = await invoke<DiscoverAlbumsResponse>('get_discover_albums', {
|
||||
endpointType,
|
||||
genreIds,
|
||||
offset,
|
||||
limit: PAGE_SIZE,
|
||||
});
|
||||
|
||||
const newAlbums = response.items.map(discoverToFavorite);
|
||||
|
||||
if (resetData) {
|
||||
albums = newAlbums;
|
||||
} else {
|
||||
albums = [...albums, ...newAlbums];
|
||||
}
|
||||
|
||||
hasMore = response.has_more;
|
||||
offset += newAlbums.length;
|
||||
|
||||
// Load download statuses for new albums (non-blocking)
|
||||
loadAlbumDownloadStatuses(newAlbums).catch(() => {});
|
||||
} catch (err) {
|
||||
console.error('Failed to fetch discover albums:', err);
|
||||
} finally {
|
||||
isLoading = false;
|
||||
isLoadingMore = false;
|
||||
}
|
||||
}
|
||||
|
||||
function handleLoadMore() {
|
||||
if (hasMore && !isLoadingMore && !isLoading) {
|
||||
fetchAlbums(false);
|
||||
}
|
||||
}
|
||||
|
||||
function handleGenreChange(e: Event) {
|
||||
const select = e.target as HTMLSelectElement;
|
||||
selectedGenreId = select.value ? Number(select.value) : null;
|
||||
fetchAlbums(true);
|
||||
}
|
||||
|
||||
function clearSearch() {
|
||||
searchQuery = '';
|
||||
}
|
||||
|
||||
async function loadGenres() {
|
||||
try {
|
||||
genres = await invoke<GenreInfo[]>('get_genres', {});
|
||||
} catch (err) {
|
||||
console.error('Failed to load genres:', err);
|
||||
}
|
||||
}
|
||||
|
||||
function getQualityLabel(item: { hires?: boolean; maximum_bit_depth?: number; maximum_sampling_rate?: number }): string {
|
||||
if (!item.hires) return 'CD';
|
||||
const depth = item.maximum_bit_depth ?? 16;
|
||||
const rate = item.maximum_sampling_rate ?? 44.1;
|
||||
return `${depth}/${rate}kHz`;
|
||||
}
|
||||
|
||||
function getAlbumYear(album: FavoriteAlbum): string | null {
|
||||
if (!album.release_date_original) return null;
|
||||
return album.release_date_original.substring(0, 4);
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
fetchAlbums(true);
|
||||
loadGenres();
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="discover-browse">
|
||||
<!-- Top bar -->
|
||||
<div class="top-bar">
|
||||
<div class="top-bar-left">
|
||||
<button class="back-btn" onclick={onBack}>
|
||||
<ChevronLeft size={20} />
|
||||
</button>
|
||||
<h1 class="page-title">{$t(titleKey)}</h1>
|
||||
</div>
|
||||
<div class="top-bar-right">
|
||||
<div class="search-wrapper">
|
||||
<Search size={16} />
|
||||
<input
|
||||
type="text"
|
||||
class="search-input"
|
||||
placeholder={$t('discover.searchPlaceholder')}
|
||||
bind:value={searchQuery}
|
||||
/>
|
||||
{#if searchQuery}
|
||||
<button class="clear-btn" onclick={clearSearch}>
|
||||
<X size={14} />
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
<select class="genre-select" onchange={handleGenreChange} value={selectedGenreId ?? ''}>
|
||||
<option value="">{$t('discover.allGenres')}</option>
|
||||
{#each genres as genre (genre.id)}
|
||||
<option value={genre.id}>{genre.name}</option>
|
||||
{/each}
|
||||
</select>
|
||||
<div class="view-toggle">
|
||||
<button
|
||||
class="toggle-btn"
|
||||
class:active={viewMode === 'grid'}
|
||||
onclick={() => viewMode = 'grid'}
|
||||
>
|
||||
<LayoutGrid size={18} />
|
||||
</button>
|
||||
<button
|
||||
class="toggle-btn"
|
||||
class:active={viewMode === 'list'}
|
||||
onclick={() => viewMode = 'list'}
|
||||
>
|
||||
<List size={18} />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Content -->
|
||||
<div class="browse-content">
|
||||
{#if isLoading}
|
||||
<div class="loading-state">
|
||||
<div class="skeleton-grid">
|
||||
{#each { length: 12 } as _}
|
||||
<div class="skeleton-card">
|
||||
<div class="skeleton-art"></div>
|
||||
<div class="skeleton-text"></div>
|
||||
<div class="skeleton-text short"></div>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
{:else if getFilteredAlbums().length === 0}
|
||||
<div class="empty-state">
|
||||
<p>{$t('discover.noResults')}</p>
|
||||
</div>
|
||||
{:else}
|
||||
<VirtualizedFavoritesAlbumGrid
|
||||
groups={[{ key: '', id: 'all', albums: getFilteredAlbums() }]}
|
||||
showGroupHeaders={false}
|
||||
{viewMode}
|
||||
onAlbumClick={onAlbumClick}
|
||||
onAlbumPlay={onAlbumPlay}
|
||||
onAlbumPlayNext={onAlbumPlayNext}
|
||||
onAlbumPlayLater={onAlbumPlayLater}
|
||||
onAlbumShareQobuz={onAlbumShareQobuz}
|
||||
onAlbumShareSonglink={onAlbumShareSonglink}
|
||||
onAlbumDownload={onAlbumDownload}
|
||||
onOpenAlbumFolder={onOpenAlbumFolder}
|
||||
onReDownloadAlbum={onReDownloadAlbum}
|
||||
onAddAlbumToPlaylist={onAddAlbumToPlaylist}
|
||||
{downloadStateVersion}
|
||||
{isAlbumDownloaded}
|
||||
{showRanking}
|
||||
onLoadMore={!searchQuery.trim() ? handleLoadMore : undefined}
|
||||
{isLoadingMore}
|
||||
{getQualityLabel}
|
||||
{getAlbumYear}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.discover-browse {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.top-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
padding: 0 0 16px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.top-bar-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.back-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border: none;
|
||||
background: var(--bg-secondary);
|
||||
color: var(--text-primary);
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
transition: background 150ms ease;
|
||||
}
|
||||
|
||||
.back-btn:hover {
|
||||
background: var(--bg-tertiary);
|
||||
}
|
||||
|
||||
.page-title {
|
||||
font-size: 22px;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
margin: 0;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.top-bar-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.search-wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
background: var(--bg-secondary);
|
||||
border-radius: 8px;
|
||||
padding: 6px 12px;
|
||||
color: var(--text-muted);
|
||||
min-width: 180px;
|
||||
}
|
||||
|
||||
.search-input {
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: var(--text-primary);
|
||||
font-size: 13px;
|
||||
outline: none;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.search-input::placeholder {
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.clear-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--text-muted);
|
||||
cursor: pointer;
|
||||
padding: 2px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.clear-btn:hover {
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.genre-select {
|
||||
background: var(--bg-secondary);
|
||||
color: var(--text-primary);
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
padding: 6px 12px;
|
||||
font-size: 13px;
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
max-width: 160px;
|
||||
}
|
||||
|
||||
.genre-select option {
|
||||
background: var(--bg-primary);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.view-toggle {
|
||||
display: flex;
|
||||
background: var(--bg-secondary);
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.toggle-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: var(--text-muted);
|
||||
cursor: pointer;
|
||||
transition: all 150ms ease;
|
||||
}
|
||||
|
||||
.toggle-btn.active {
|
||||
background: var(--bg-tertiary);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.toggle-btn:hover:not(.active) {
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.browse-content {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.loading-state {
|
||||
padding: 16px 0;
|
||||
}
|
||||
|
||||
.skeleton-grid {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 24px 14px;
|
||||
}
|
||||
|
||||
.skeleton-card {
|
||||
width: 180px;
|
||||
}
|
||||
|
||||
.skeleton-art {
|
||||
width: 180px;
|
||||
height: 180px;
|
||||
border-radius: 8px;
|
||||
background: var(--bg-secondary);
|
||||
animation: pulse 1.5s ease-in-out infinite;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.skeleton-text {
|
||||
height: 14px;
|
||||
background: var(--bg-secondary);
|
||||
border-radius: 4px;
|
||||
animation: pulse 1.5s ease-in-out infinite;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.skeleton-text.short {
|
||||
width: 60%;
|
||||
}
|
||||
|
||||
@keyframes pulse {
|
||||
0%, 100% { opacity: 0.4; }
|
||||
50% { opacity: 0.7; }
|
||||
}
|
||||
|
||||
.empty-state {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 200px;
|
||||
color: var(--text-muted);
|
||||
font-size: 14px;
|
||||
}
|
||||
</style>
|
||||
@@ -121,6 +121,9 @@
|
||||
onPlaylistShareQobuz?: (playlistId: number) => void;
|
||||
activeTrackId?: number | null;
|
||||
isPlaybackActive?: boolean;
|
||||
onNavigateNewReleases?: () => void;
|
||||
onNavigateIdealDiscography?: () => void;
|
||||
onNavigateTopAlbums?: () => void;
|
||||
}
|
||||
|
||||
let {
|
||||
@@ -159,7 +162,10 @@
|
||||
onPlaylistCopyToLibrary,
|
||||
onPlaylistShareQobuz,
|
||||
activeTrackId = null,
|
||||
isPlaybackActive = false
|
||||
isPlaybackActive = false,
|
||||
onNavigateNewReleases,
|
||||
onNavigateIdealDiscography,
|
||||
onNavigateTopAlbums,
|
||||
}: Props = $props();
|
||||
|
||||
// Home settings state
|
||||
@@ -882,7 +888,13 @@
|
||||
</div>
|
||||
</div>
|
||||
{:else if newReleases.length > 0}
|
||||
<HorizontalScrollRow title={$t('home.newReleases')}>
|
||||
<HorizontalScrollRow>
|
||||
{#snippet header()}
|
||||
<h2 class="section-title">{$t('home.newReleases')}</h2>
|
||||
{#if onNavigateNewReleases}
|
||||
<button class="see-all-link" onclick={onNavigateNewReleases}>{$t('home.seeAll')}</button>
|
||||
{/if}
|
||||
{/snippet}
|
||||
{#snippet children()}
|
||||
{#each newReleases as album}
|
||||
<AlbumCard
|
||||
@@ -968,7 +980,13 @@
|
||||
</div>
|
||||
</div>
|
||||
{:else if mostStreamed.length > 0}
|
||||
<HorizontalScrollRow title={$t('home.popularAlbums')}>
|
||||
<HorizontalScrollRow>
|
||||
{#snippet header()}
|
||||
<h2 class="section-title">{$t('home.popularAlbums')}</h2>
|
||||
{#if onNavigateTopAlbums}
|
||||
<button class="see-all-link" onclick={onNavigateTopAlbums}>{$t('home.seeAll')}</button>
|
||||
{/if}
|
||||
{/snippet}
|
||||
{#snippet children()}
|
||||
{#each mostStreamed as album}
|
||||
<AlbumCard
|
||||
@@ -1147,7 +1165,13 @@
|
||||
</div>
|
||||
</div>
|
||||
{:else if essentialDiscography.length > 0}
|
||||
<HorizontalScrollRow title={$t('home.essentialDiscography')}>
|
||||
<HorizontalScrollRow>
|
||||
{#snippet header()}
|
||||
<h2 class="section-title">{$t('home.essentialDiscography')}</h2>
|
||||
{#if onNavigateIdealDiscography}
|
||||
<button class="see-all-link" onclick={onNavigateIdealDiscography}>{$t('home.seeAll')}</button>
|
||||
{/if}
|
||||
{/snippet}
|
||||
{#snippet children()}
|
||||
{#each essentialDiscography as album (album.id)}
|
||||
<AlbumCard
|
||||
@@ -1704,4 +1728,27 @@
|
||||
from { transform: rotate(0deg); }
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 22px;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.see-all-link {
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--accent-primary, #7c5cbf);
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
padding: 0;
|
||||
white-space: nowrap;
|
||||
transition: opacity 150ms ease;
|
||||
}
|
||||
|
||||
.see-all-link:hover {
|
||||
opacity: 0.8;
|
||||
}
|
||||
</style>
|
||||
@@ -45,6 +45,16 @@
|
||||
"startListening": "Beginne mit dem Hören",
|
||||
"startListeningDescription": "Spiele Musik oder füge Favoriten hinzu, um Empfehlungen zu aktivieren."
|
||||
},
|
||||
"discover": {
|
||||
"newReleases": "Neuerscheinungen",
|
||||
"idealDiscography": "Ideale Diskografie",
|
||||
"topAlbums": "Beliebte Alben",
|
||||
"loadingMore": "Mehr laden...",
|
||||
"noResults": "Keine Alben gefunden",
|
||||
"searchPlaceholder": "Alben suchen...",
|
||||
"allGenres": "Alle Genres",
|
||||
"backToHome": "Zurück zur Startseite"
|
||||
},
|
||||
"search": {
|
||||
"title": "Suchen",
|
||||
"placeholder": "Alben, Künstler, Titel suchen...",
|
||||
|
||||
@@ -48,6 +48,16 @@
|
||||
"startListening": "Start Listening",
|
||||
"startListeningDescription": "Play music or add favorites to activate recommendations."
|
||||
},
|
||||
"discover": {
|
||||
"newReleases": "New Releases",
|
||||
"idealDiscography": "Ideal Discography",
|
||||
"topAlbums": "Top Albums",
|
||||
"loadingMore": "Loading more...",
|
||||
"noResults": "No albums found",
|
||||
"searchPlaceholder": "Search albums...",
|
||||
"allGenres": "All Genres",
|
||||
"backToHome": "Back to Home"
|
||||
},
|
||||
"search": {
|
||||
"title": "Search",
|
||||
"placeholder": "Search albums, artists, tracks...",
|
||||
|
||||
@@ -48,6 +48,16 @@
|
||||
"startListening": "Empieza a Escuchar",
|
||||
"startListeningDescription": "Reproduce música o agrega favoritos para activar recomendaciones."
|
||||
},
|
||||
"discover": {
|
||||
"newReleases": "Novedades",
|
||||
"idealDiscography": "Discografía Ideal",
|
||||
"topAlbums": "Álbumes Populares",
|
||||
"loadingMore": "Cargando más...",
|
||||
"noResults": "No se encontraron álbumes",
|
||||
"searchPlaceholder": "Buscar álbumes...",
|
||||
"allGenres": "Todos los Géneros",
|
||||
"backToHome": "Volver al Inicio"
|
||||
},
|
||||
"search": {
|
||||
"title": "Buscar",
|
||||
"placeholder": "Buscar álbumes, artistas, pistas...",
|
||||
|
||||
@@ -45,6 +45,16 @@
|
||||
"startListening": "Commencer l'écoute",
|
||||
"startListeningDescription": "Lisez de la musique ou ajoutez des favoris pour activer les recommandations."
|
||||
},
|
||||
"discover": {
|
||||
"newReleases": "Nouvelles sorties",
|
||||
"idealDiscography": "Discographie idéale",
|
||||
"topAlbums": "Albums populaires",
|
||||
"loadingMore": "Chargement...",
|
||||
"noResults": "Aucun album trouvé",
|
||||
"searchPlaceholder": "Rechercher des albums...",
|
||||
"allGenres": "Tous les genres",
|
||||
"backToHome": "Retour à l'accueil"
|
||||
},
|
||||
"search": {
|
||||
"title": "Recherche",
|
||||
"placeholder": "Rechercher des albums, des artistes, des pistes...",
|
||||
|
||||
@@ -22,7 +22,10 @@ export type ViewType =
|
||||
| 'favorites-tracks'
|
||||
| 'favorites-albums'
|
||||
| 'favorites-artists'
|
||||
| 'favorites-playlists';
|
||||
| 'favorites-playlists'
|
||||
| 'discover-new-releases'
|
||||
| 'discover-ideal-discography'
|
||||
| 'discover-top-albums';
|
||||
export type FavoritesTab = 'tracks' | 'albums' | 'artists' | 'playlists';
|
||||
|
||||
// Navigation state
|
||||
|
||||
@@ -314,6 +314,7 @@
|
||||
import LocalLibraryView from '$lib/components/views/LocalLibraryView.svelte';
|
||||
import PlaylistManagerView from '$lib/components/views/PlaylistManagerView.svelte';
|
||||
import BlacklistManagerView from '$lib/components/views/BlacklistManagerView.svelte';
|
||||
import DiscoverBrowseView from '$lib/components/views/DiscoverBrowseView.svelte';
|
||||
|
||||
// Overlays
|
||||
import QueuePanel from '$lib/components/QueuePanel.svelte';
|
||||
@@ -3114,6 +3115,9 @@
|
||||
onPlaylistShareQobuz={sharePlaylistQobuzLinkById}
|
||||
activeTrackId={currentTrack?.id ?? null}
|
||||
isPlaybackActive={isPlaying}
|
||||
onNavigateNewReleases={() => navigateTo('discover-new-releases')}
|
||||
onNavigateIdealDiscography={() => navigateTo('discover-ideal-discography')}
|
||||
onNavigateTopAlbums={() => navigateTo('discover-top-albums')}
|
||||
/>
|
||||
{/if}
|
||||
{:else if activeView === 'search'}
|
||||
@@ -3395,6 +3399,64 @@
|
||||
onBack={navGoBack}
|
||||
onArtistSelect={handleArtistClick}
|
||||
/>
|
||||
{:else if activeView === 'discover-new-releases'}
|
||||
<DiscoverBrowseView
|
||||
endpointType="newReleases"
|
||||
titleKey="discover.newReleases"
|
||||
onBack={navGoBack}
|
||||
onAlbumClick={handleAlbumClick}
|
||||
onAlbumPlay={playAlbumById}
|
||||
onAlbumPlayNext={queueAlbumNextById}
|
||||
onAlbumPlayLater={queueAlbumLaterById}
|
||||
onAlbumShareQobuz={shareAlbumQobuzLinkById}
|
||||
onAlbumShareSonglink={shareAlbumSonglinkById}
|
||||
onAlbumDownload={downloadAlbumById}
|
||||
onOpenAlbumFolder={openAlbumFolderById}
|
||||
onReDownloadAlbum={reDownloadAlbumById}
|
||||
onAddAlbumToPlaylist={addAlbumToPlaylistById}
|
||||
checkAlbumFullyDownloaded={checkAlbumFullyDownloaded}
|
||||
{downloadStateVersion}
|
||||
onArtistClick={handleArtistClick}
|
||||
/>
|
||||
{:else if activeView === 'discover-ideal-discography'}
|
||||
<DiscoverBrowseView
|
||||
endpointType="idealDiscography"
|
||||
titleKey="discover.idealDiscography"
|
||||
onBack={navGoBack}
|
||||
onAlbumClick={handleAlbumClick}
|
||||
onAlbumPlay={playAlbumById}
|
||||
onAlbumPlayNext={queueAlbumNextById}
|
||||
onAlbumPlayLater={queueAlbumLaterById}
|
||||
onAlbumShareQobuz={shareAlbumQobuzLinkById}
|
||||
onAlbumShareSonglink={shareAlbumSonglinkById}
|
||||
onAlbumDownload={downloadAlbumById}
|
||||
onOpenAlbumFolder={openAlbumFolderById}
|
||||
onReDownloadAlbum={reDownloadAlbumById}
|
||||
onAddAlbumToPlaylist={addAlbumToPlaylistById}
|
||||
checkAlbumFullyDownloaded={checkAlbumFullyDownloaded}
|
||||
{downloadStateVersion}
|
||||
onArtistClick={handleArtistClick}
|
||||
/>
|
||||
{:else if activeView === 'discover-top-albums'}
|
||||
<DiscoverBrowseView
|
||||
endpointType="mostStreamed"
|
||||
titleKey="discover.topAlbums"
|
||||
showRanking={true}
|
||||
onBack={navGoBack}
|
||||
onAlbumClick={handleAlbumClick}
|
||||
onAlbumPlay={playAlbumById}
|
||||
onAlbumPlayNext={queueAlbumNextById}
|
||||
onAlbumPlayLater={queueAlbumLaterById}
|
||||
onAlbumShareQobuz={shareAlbumQobuzLinkById}
|
||||
onAlbumShareSonglink={shareAlbumSonglinkById}
|
||||
onAlbumDownload={downloadAlbumById}
|
||||
onOpenAlbumFolder={openAlbumFolderById}
|
||||
onReDownloadAlbum={reDownloadAlbumById}
|
||||
onAddAlbumToPlaylist={addAlbumToPlaylistById}
|
||||
checkAlbumFullyDownloaded={checkAlbumFullyDownloaded}
|
||||
{downloadStateVersion}
|
||||
onArtistClick={handleArtistClick}
|
||||
/>
|
||||
{/if}
|
||||
</main>
|
||||
|
||||
|
||||
Reference in new issue
Block a user