remove full-page overlay, add progressive skeleton rendering

Replace the blocking overlay system with per-section skeleton
placeholders that appear immediately and swap to real content
as each section loads independently. Download status checks are
now fire-and-forget (no longer block section display). Remove
all DEBUG-43 console warnings. Remove unused sidebarExpanded prop.
This commit is contained in:
vicrodh committed 2026-02-06 22:06:19 -06:00
1 parent 08dc86b987
commit cba9b5a3fa
2 files changed
+208 -253

No files matched your search

+208 -252
View File
@@ -113,7 +113,6 @@
onPlaylistShareQobuz?: (playlistId: number) => void; onPlaylistShareQobuz?: (playlistId: number) => void;
activeTrackId?: number | null; activeTrackId?: number | null;
isPlaybackActive?: boolean; isPlaybackActive?: boolean;
sidebarExpanded?: boolean;
} }
let { let {
@@ -152,8 +151,7 @@
onPlaylistCopyToLibrary, onPlaylistCopyToLibrary,
onPlaylistShareQobuz, onPlaylistShareQobuz,
activeTrackId = null, activeTrackId = null,
isPlaybackActive = false, isPlaybackActive = false
sidebarExpanded = true
}: Props = $props(); }: Props = $props();
// Home settings state // Home settings state
@@ -181,18 +179,7 @@
homeSettings.sections.filter(s => s.visible).map(s => s.id) homeSettings.sections.filter(s => s.visible).map(s => s.id)
); );
// Deferred rendering: only render first N sections immediately, defer the rest const renderableSections = $derived(visibleSections);
const IMMEDIATE_SECTIONS = 3;
let deferredSectionsReady = $state(false);
// Sections to render immediately vs deferred
const immediateSections = $derived(visibleSections.slice(0, IMMEDIATE_SECTIONS));
const deferredSections = $derived(visibleSections.slice(IMMEDIATE_SECTIONS));
// All sections ready to render
const renderableSections = $derived(
deferredSectionsReady ? visibleSections : immediateSections
);
const LIMITS = { const LIMITS = {
recentAlbums: 20, recentAlbums: 20,
@@ -207,9 +194,7 @@
let homeLimits = $state(getSettings().limits); let homeLimits = $state(getSettings().limits);
// Loading states for progressive render // Loading states for progressive render (each section independent)
let isInitializing = $state(true);
let isOverlayVisible = $state(true); // Overlay that fades out when ALL sections ready
let error = $state<string | null>(null); let error = $state<string | null>(null);
let loadingNewReleases = $state(true); let loadingNewReleases = $state(true);
let loadingPressAwards = $state(true); let loadingPressAwards = $state(true);
@@ -223,9 +208,13 @@
let loadingQobuzPlaylists = $state(true); let loadingQobuzPlaylists = $state(true);
let loadingEssentialDiscography = $state(true); let loadingEssentialDiscography = $state(true);
// Track loading completion for overlay // True when all sections have finished loading (for empty state detection)
let totalVisibleSections = $state(0); const anyLoading = $derived(
let sectionsFinished = $state(0); loadingNewReleases || loadingPressAwards || loadingMostStreamed ||
loadingQobuzissimes || loadingEditorPicks || loadingRecentAlbums ||
loadingContinueTracks || loadingTopArtists || loadingFavoriteAlbums ||
loadingQobuzPlaylists || loadingEssentialDiscography
);
// Featured albums (from Qobuz editorial) // Featured albums (from Qobuz editorial)
let newReleases = $state<AlbumCardData[]>([]); let newReleases = $state<AlbumCardData[]>([]);
@@ -309,41 +298,6 @@
|| essentialDiscography.length > 0 || essentialDiscography.length > 0
); );
// Mark a section as finished loading and check if we can hide overlay
function markSectionFinished() {
sectionsFinished++;
console.warn(`[DEBUG-43] markSectionFinished: ${sectionsFinished}/${totalVisibleSections}`);
checkAllSectionsReady();
}
// Check if all visible sections have finished loading
function checkAllSectionsReady() {
if (sectionsFinished >= totalVisibleSections && totalVisibleSections > 0 && isOverlayVisible) {
console.warn(`[DEBUG-43] ALL SECTIONS READY (${sectionsFinished}/${totalVisibleSections}), removing overlay in 150ms`);
// Small delay to ensure DOM has rendered, then fade out
setTimeout(() => {
isOverlayVisible = false;
isInitializing = false;
console.warn('[DEBUG-43] Overlay removed. hasContent =',
newReleases.length > 0 || pressAwards.length > 0 || mostStreamed.length > 0 ||
qobuzissimes.length > 0 || editorPicks.length > 0 || recentAlbums.length > 0 ||
continueTracks.length > 0 || topArtists.length > 0 || favoriteAlbums.length > 0 ||
qobuzPlaylists.length > 0 || essentialDiscography.length > 0,
'error =', error);
}, 150);
// Enable deferred sections after a short delay using requestIdleCallback
if ('requestIdleCallback' in window) {
requestIdleCallback(() => {
deferredSectionsReady = true;
}, { timeout: 500 });
} else {
setTimeout(() => {
deferredSectionsReady = true;
}, 300);
}
}
}
onMount(() => { onMount(() => {
// Subscribe to home settings changes // Subscribe to home settings changes
@@ -480,16 +434,14 @@
async function fetchFeaturedAlbumsSingle(featuredType: string, limit: number, genreId?: number): Promise<AlbumCardData[]> { async function fetchFeaturedAlbumsSingle(featuredType: string, limit: number, genreId?: number): Promise<AlbumCardData[]> {
try { try {
console.warn(`[DEBUG-43] fetchFeaturedAlbums: type=${featuredType}, limit=${limit}, genreId=${genreId ?? 'null'}`);
const response = await invoke<FeaturedAlbumsResponse>('get_featured_albums', { const response = await invoke<FeaturedAlbumsResponse>('get_featured_albums', {
featuredType, featuredType,
limit, limit,
genreId: genreId ?? null genreId: genreId ?? null
}); });
console.warn(`[DEBUG-43] fetchFeaturedAlbums result: type=${featuredType}, returned=${response.items.length} albums`);
return response.items.map(toAlbumCard); return response.items.map(toAlbumCard);
} catch (err) { } catch (err) {
console.error(`[DEBUG-43] Failed to fetch ${featuredType}:`, err); console.error(`Failed to fetch ${featuredType}:`, err);
return []; return [];
} }
} }
@@ -665,14 +617,11 @@
async function fetchDiscoverData() { async function fetchDiscoverData() {
try { try {
console.warn('[DEBUG-43] fetchDiscoverData: invoking get_discover_index...');
const response = await invoke<DiscoverResponse>('get_discover_index', { genreIds: null }); const response = await invoke<DiscoverResponse>('get_discover_index', { genreIds: null });
console.warn('[DEBUG-43] fetchDiscoverData: response received, containers:', Object.keys(response.containers || {}));
// Extract playlists (limited) - initial load without tag filter // Extract playlists (limited) - initial load without tag filter
if (response.containers.playlists?.data?.items) { if (response.containers.playlists?.data?.items) {
qobuzPlaylists = response.containers.playlists.data.items.slice(0, LIMITS.qobuzPlaylists); qobuzPlaylists = response.containers.playlists.data.items.slice(0, LIMITS.qobuzPlaylists);
console.warn('[DEBUG-43] fetchDiscoverData: playlists =', qobuzPlaylists.length);
} }
// Extract playlist tags // Extract playlist tags
@@ -683,36 +632,18 @@
// Extract essential discography (limited) // Extract essential discography (limited)
if (response.containers.ideal_discography?.data?.items) { if (response.containers.ideal_discography?.data?.items) {
essentialDiscography = response.containers.ideal_discography.data.items.slice(0, LIMITS.essentialDiscography); essentialDiscography = response.containers.ideal_discography.data.items.slice(0, LIMITS.essentialDiscography);
console.warn('[DEBUG-43] fetchDiscoverData: essentialDiscography =', essentialDiscography.length);
} }
loadingQobuzPlaylists = false; loadingQobuzPlaylists = false;
loadingEssentialDiscography = false; loadingEssentialDiscography = false;
if (isSectionVisible('qobuzPlaylists')) {
markSectionFinished();
}
if (isSectionVisible('essentialDiscography')) {
markSectionFinished();
}
} catch (err) { } catch (err) {
console.error('[DEBUG-43] fetchDiscoverData FAILED:', err); console.error('fetchDiscoverData failed:', err);
loadingQobuzPlaylists = false; loadingQobuzPlaylists = false;
loadingEssentialDiscography = false; loadingEssentialDiscography = false;
// Still mark sections as finished even on error
if (isSectionVisible('qobuzPlaylists')) {
markSectionFinished();
}
if (isSectionVisible('essentialDiscography')) {
markSectionFinished();
}
} }
} }
async function loadHome() { async function loadHome() {
isInitializing = true;
isOverlayVisible = true;
sectionsFinished = 0;
error = null; error = null;
loadingNewReleases = true; loadingNewReleases = true;
loadingPressAwards = true; loadingPressAwards = true;
@@ -726,23 +657,7 @@
loadingQobuzPlaylists = true; loadingQobuzPlaylists = true;
loadingEssentialDiscography = true; loadingEssentialDiscography = true;
// Count total visible sections to know when we're done
totalVisibleSections = 0;
if (isSectionVisible('newReleases')) totalVisibleSections++;
if (isSectionVisible('pressAwards')) totalVisibleSections++;
if (isSectionVisible('mostStreamed')) totalVisibleSections++;
if (isSectionVisible('qobuzissimes')) totalVisibleSections++;
if (isSectionVisible('editorPicks')) totalVisibleSections++;
if (isSectionVisible('recentAlbums')) totalVisibleSections++;
if (isSectionVisible('continueTracks')) totalVisibleSections++;
if (isSectionVisible('topArtists')) totalVisibleSections++;
if (isSectionVisible('favoriteAlbums')) totalVisibleSections++;
if (isSectionVisible('qobuzPlaylists')) totalVisibleSections++;
if (isSectionVisible('essentialDiscography')) totalVisibleSections++;
console.warn('[DEBUG-43] loadHome: totalVisibleSections =', totalVisibleSections);
// Start ML data loading FIRST (local SQLite) - this gets the seeds // Start ML data loading FIRST (local SQLite) - this gets the seeds
console.warn('[DEBUG-43] loadHome: invoking reco_get_home_ml...');
const mlPromise = invoke<HomeSeeds>('reco_get_home_ml', { const mlPromise = invoke<HomeSeeds>('reco_get_home_ml', {
limitRecentAlbums: homeLimits.recentAlbums, limitRecentAlbums: homeLimits.recentAlbums,
limitContinueTracks: homeLimits.continueTracks, limitContinueTracks: homeLimits.continueTracks,
@@ -755,80 +670,65 @@
// Start Qobuz API calls in parallel (don't await) // Start Qobuz API calls in parallel (don't await)
if (isSectionVisible('newReleases')) { if (isSectionVisible('newReleases')) {
fetchFeaturedAlbums('new-releases', homeLimits.featuredAlbums, genreIds).then(async albums => { fetchFeaturedAlbums('new-releases', homeLimits.featuredAlbums, genreIds).then(albums => {
newReleases = albums; newReleases = albums;
await loadAllAlbumDownloadStatuses(albums);
loadingNewReleases = false; loadingNewReleases = false;
console.warn('[DEBUG-43] section finished: newReleases', albums.length, 'albums'); loadAllAlbumDownloadStatuses(albums);
markSectionFinished();
}).catch(err => { }).catch(err => {
console.error('[DEBUG-43] section FAILED: newReleases', err); console.error('Failed to load newReleases:', err);
loadingNewReleases = false; loadingNewReleases = false;
markSectionFinished();
}); });
} else { } else {
loadingNewReleases = false; loadingNewReleases = false;
} }
if (isSectionVisible('pressAwards')) { if (isSectionVisible('pressAwards')) {
fetchFeaturedAlbums('press-awards', homeLimits.featuredAlbums, genreIds).then(async albums => { fetchFeaturedAlbums('press-awards', homeLimits.featuredAlbums, genreIds).then(albums => {
pressAwards = albums; pressAwards = albums;
await loadAllAlbumDownloadStatuses(albums);
loadingPressAwards = false; loadingPressAwards = false;
console.warn('[DEBUG-43] section finished: pressAwards', albums.length, 'albums'); loadAllAlbumDownloadStatuses(albums);
markSectionFinished();
}).catch(err => { }).catch(err => {
console.error('[DEBUG-43] section FAILED: pressAwards', err); console.error('Failed to load pressAwards:', err);
loadingPressAwards = false; loadingPressAwards = false;
markSectionFinished();
}); });
} else { } else {
loadingPressAwards = false; loadingPressAwards = false;
} }
if (isSectionVisible('mostStreamed')) { if (isSectionVisible('mostStreamed')) {
fetchFeaturedAlbums('most-streamed', homeLimits.featuredAlbums, genreIds).then(async albums => { fetchFeaturedAlbums('most-streamed', homeLimits.featuredAlbums, genreIds).then(albums => {
mostStreamed = albums; mostStreamed = albums;
await loadAllAlbumDownloadStatuses(albums);
loadingMostStreamed = false; loadingMostStreamed = false;
console.warn('[DEBUG-43] section finished: mostStreamed', albums.length, 'albums'); loadAllAlbumDownloadStatuses(albums);
markSectionFinished();
}).catch(err => { }).catch(err => {
console.error('[DEBUG-43] section FAILED: mostStreamed', err); console.error('Failed to load mostStreamed:', err);
loadingMostStreamed = false; loadingMostStreamed = false;
markSectionFinished();
}); });
} else { } else {
loadingMostStreamed = false; loadingMostStreamed = false;
} }
if (isSectionVisible('qobuzissimes')) { if (isSectionVisible('qobuzissimes')) {
fetchFeaturedAlbums('qobuzissimes', homeLimits.featuredAlbums, genreIds).then(async albums => { fetchFeaturedAlbums('qobuzissimes', homeLimits.featuredAlbums, genreIds).then(albums => {
qobuzissimes = albums; qobuzissimes = albums;
await loadAllAlbumDownloadStatuses(albums);
loadingQobuzissimes = false; loadingQobuzissimes = false;
console.warn('[DEBUG-43] section finished: qobuzissimes', albums.length, 'albums'); loadAllAlbumDownloadStatuses(albums);
markSectionFinished();
}).catch(err => { }).catch(err => {
console.error('[DEBUG-43] section FAILED: qobuzissimes', err); console.error('Failed to load qobuzissimes:', err);
loadingQobuzissimes = false; loadingQobuzissimes = false;
markSectionFinished();
}); });
} else { } else {
loadingQobuzissimes = false; loadingQobuzissimes = false;
} }
if (isSectionVisible('editorPicks')) { if (isSectionVisible('editorPicks')) {
fetchFeaturedAlbums('editor-picks', homeLimits.featuredAlbums, genreIds).then(async albums => { fetchFeaturedAlbums('editor-picks', homeLimits.featuredAlbums, genreIds).then(albums => {
editorPicks = albums; editorPicks = albums;
await loadAllAlbumDownloadStatuses(albums);
loadingEditorPicks = false; loadingEditorPicks = false;
console.warn('[DEBUG-43] section finished: editorPicks', albums.length, 'albums'); loadAllAlbumDownloadStatuses(albums);
markSectionFinished();
}).catch(err => { }).catch(err => {
console.error('[DEBUG-43] section FAILED: editorPicks', err); console.error('Failed to load editorPicks:', err);
loadingEditorPicks = false; loadingEditorPicks = false;
markSectionFinished();
}); });
} else { } else {
loadingEditorPicks = false; loadingEditorPicks = false;
@@ -846,13 +746,6 @@
try { try {
// Wait for ML seeds (local data) // Wait for ML seeds (local data)
const seeds = await mlPromise; const seeds = await mlPromise;
console.warn('[DEBUG-43] mlPromise resolved:', {
recentAlbums: seeds.recentlyPlayedAlbumIds?.length ?? 0,
continueTracks: seeds.continueListeningTrackIds?.length ?? 0,
topArtists: seeds.topArtistIds?.length ?? 0,
favoriteAlbums: seeds.favoriteAlbumIds?.length ?? 0,
favoriteTracks: seeds.favoriteTrackIds?.length ?? 0,
});
// Load ML-based sections in parallel // Load ML-based sections in parallel
// Continue Listening (tracks) // Continue Listening (tracks)
@@ -860,12 +753,9 @@
fetchTracks(seeds.continueListeningTrackIds).then(tracks => { fetchTracks(seeds.continueListeningTrackIds).then(tracks => {
continueTracks = tracks; continueTracks = tracks;
loadingContinueTracks = false; loadingContinueTracks = false;
console.warn('[DEBUG-43] section finished: continueTracks', tracks.length, 'tracks');
markSectionFinished();
}).catch(err => { }).catch(err => {
console.error('[DEBUG-43] section FAILED: continueTracks', err); console.error('Failed to load continueTracks:', err);
loadingContinueTracks = false; loadingContinueTracks = false;
markSectionFinished();
}); });
} else { } else {
loadingContinueTracks = false; loadingContinueTracks = false;
@@ -876,17 +766,14 @@
const recentAlbumIds = normalizeAlbumIds(seeds.recentlyPlayedAlbumIds); const recentAlbumIds = normalizeAlbumIds(seeds.recentlyPlayedAlbumIds);
// Fetch more if filtering, to have enough after filter // Fetch more if filtering, to have enough after filter
const fetchLimit = hasGenreFilter() ? homeLimits.recentAlbums * 3 : homeLimits.recentAlbums; const fetchLimit = hasGenreFilter() ? homeLimits.recentAlbums * 3 : homeLimits.recentAlbums;
fetchAlbums(recentAlbumIds.slice(0, fetchLimit)).then(async albums => { fetchAlbums(recentAlbumIds.slice(0, fetchLimit)).then(albums => {
const filtered = filterAlbumsByGenre(albums).slice(0, homeLimits.recentAlbums); const filtered = filterAlbumsByGenre(albums).slice(0, homeLimits.recentAlbums);
recentAlbums = filtered; recentAlbums = filtered;
await loadAllAlbumDownloadStatuses(filtered);
loadingRecentAlbums = false; loadingRecentAlbums = false;
console.warn('[DEBUG-43] section finished: recentAlbums', filtered.length, 'albums'); loadAllAlbumDownloadStatuses(filtered);
markSectionFinished();
}).catch(err => { }).catch(err => {
console.error('[DEBUG-43] section FAILED: recentAlbums', err); console.error('Failed to load recentAlbums:', err);
loadingRecentAlbums = false; loadingRecentAlbums = false;
markSectionFinished();
}); });
} else { } else {
loadingRecentAlbums = false; loadingRecentAlbums = false;
@@ -897,12 +784,9 @@
fetchArtists(seeds.topArtistIds.slice(0, homeLimits.topArtists)).then(artists => { fetchArtists(seeds.topArtistIds.slice(0, homeLimits.topArtists)).then(artists => {
topArtists = artists; topArtists = artists;
loadingTopArtists = false; loadingTopArtists = false;
console.warn('[DEBUG-43] section finished: topArtists', artists.length, 'artists');
markSectionFinished();
}).catch(err => { }).catch(err => {
console.error('[DEBUG-43] section FAILED: topArtists', err); console.error('Failed to load topArtists:', err);
loadingTopArtists = false; loadingTopArtists = false;
markSectionFinished();
}); });
} else { } else {
loadingTopArtists = false; loadingTopArtists = false;
@@ -921,50 +805,28 @@
const albums = await fetchAlbums(favoriteAlbumIds.slice(0, fetchLimit)); const albums = await fetchAlbums(favoriteAlbumIds.slice(0, fetchLimit));
const filtered = filterAlbumsByGenre(albums).slice(0, homeLimits.favoriteAlbums); const filtered = filterAlbumsByGenre(albums).slice(0, homeLimits.favoriteAlbums);
favoriteAlbums = filtered; favoriteAlbums = filtered;
await loadAllAlbumDownloadStatuses(filtered);
loadingFavoriteAlbums = false; loadingFavoriteAlbums = false;
console.warn('[DEBUG-43] section finished: favoriteAlbums', filtered.length, 'albums'); loadAllAlbumDownloadStatuses(filtered);
markSectionFinished();
}).catch(err => { }).catch(err => {
console.error('[DEBUG-43] section FAILED: favoriteAlbums', err); console.error('Failed to load favoriteAlbums:', err);
loadingFavoriteAlbums = false; loadingFavoriteAlbums = false;
markSectionFinished();
}); });
} else { } else {
loadingFavoriteAlbums = false; loadingFavoriteAlbums = false;
} }
} catch (err) { } catch (err) {
console.error('[DEBUG-43] mlPromise FAILED — catch block entered:', err); console.error('ML seeds failed:', err);
console.error('[DEBUG-43] This sets error= which BLOCKS all content rendering.');
console.error('[DEBUG-43] Featured album sections already in flight will finish but be invisible.');
error = String(err); error = String(err);
isInitializing = false;
isOverlayVisible = false;
loadingRecentAlbums = false; loadingRecentAlbums = false;
loadingContinueTracks = false; loadingContinueTracks = false;
loadingTopArtists = false; loadingTopArtists = false;
loadingFavoriteAlbums = false; loadingFavoriteAlbums = false;
loadingQobuzPlaylists = false;
loadingEssentialDiscography = false;
} }
} }
</script> </script>
<div class="home-view"> <div class="home-view">
<!-- Loading Overlay - fades out when ALL sections are ready -->
{#if isOverlayVisible}
<div class="loading-overlay" class:fade-out={sectionsFinished >= totalVisibleSections && totalVisibleSections > 0} style="left: {sidebarExpanded ? '280px' : '64px'}">
<div class="loading-content">
<div class="loading-icon">
<Loader2 size={36} class="spinner" />
</div>
<h2>{$t('home.loading')}</h2>
<p>{$t('home.loadingDescription')}</p>
</div>
</div>
{/if}
<!-- Header with greeting, filter and settings --> <!-- Header with greeting, filter and settings -->
<div class="home-header"> <div class="home-header">
{#if homeSettings.greeting.enabled} {#if homeSettings.greeting.enabled}
@@ -980,15 +842,7 @@
</div> </div>
</div> </div>
{#if isInitializing && !isOverlayVisible} {#if error}
<div class="home-state">
<div class="state-icon loading">
<Loader2 size={36} class="spinner" />
</div>
<h1>{$t('home.loading')}</h1>
<p>{$t('home.loadingDescription')}</p>
</div>
{:else if error}
<div class="home-state"> <div class="home-state">
<div class="state-icon"> <div class="state-icon">
<Music size={36} /> <Music size={36} />
@@ -996,10 +850,19 @@
<h1>{$t('home.loadError')}</h1> <h1>{$t('home.loadError')}</h1>
<p>{error}</p> <p>{error}</p>
</div> </div>
{:else if hasContent} {/if}
<!-- Render sections in user-defined order -->
{#each renderableSections as sectionId (sectionId)} <!-- Progressive sections: each appears as soon as its data arrives -->
{#if sectionId === 'newReleases' && newReleases.length > 0} {#each renderableSections as sectionId (sectionId)}
{#if sectionId === 'newReleases'}
{#if loadingNewReleases}
<div class="skeleton-section">
<div class="skeleton-title"></div>
<div class="skeleton-row">
{#each { length: 6 } as _}<div class="skeleton-card"></div>{/each}
</div>
</div>
{:else if newReleases.length > 0}
<HorizontalScrollRow title={$t('home.newReleases')}> <HorizontalScrollRow title={$t('home.newReleases')}>
{#snippet children()} {#snippet children()}
{#each newReleases as album} {#each newReleases as album}
@@ -1030,8 +893,17 @@
{/snippet} {/snippet}
</HorizontalScrollRow> </HorizontalScrollRow>
{/if} {/if}
{/if}
{#if sectionId === 'pressAwards' && pressAwards.length > 0} {#if sectionId === 'pressAwards'}
{#if loadingPressAwards}
<div class="skeleton-section">
<div class="skeleton-title"></div>
<div class="skeleton-row">
{#each { length: 6 } as _}<div class="skeleton-card"></div>{/each}
</div>
</div>
{:else if pressAwards.length > 0}
<HorizontalScrollRow title={$t('home.pressAwards')}> <HorizontalScrollRow title={$t('home.pressAwards')}>
{#snippet children()} {#snippet children()}
{#each pressAwards as album} {#each pressAwards as album}
@@ -1062,8 +934,17 @@
{/snippet} {/snippet}
</HorizontalScrollRow> </HorizontalScrollRow>
{/if} {/if}
{/if}
{#if sectionId === 'mostStreamed' && mostStreamed.length > 0} {#if sectionId === 'mostStreamed'}
{#if loadingMostStreamed}
<div class="skeleton-section">
<div class="skeleton-title"></div>
<div class="skeleton-row">
{#each { length: 6 } as _}<div class="skeleton-card"></div>{/each}
</div>
</div>
{:else if mostStreamed.length > 0}
<HorizontalScrollRow title={$t('home.popularAlbums')}> <HorizontalScrollRow title={$t('home.popularAlbums')}>
{#snippet children()} {#snippet children()}
{#each mostStreamed as album} {#each mostStreamed as album}
@@ -1094,8 +975,17 @@
{/snippet} {/snippet}
</HorizontalScrollRow> </HorizontalScrollRow>
{/if} {/if}
{/if}
{#if sectionId === 'qobuzissimes' && qobuzissimes.length > 0} {#if sectionId === 'qobuzissimes'}
{#if loadingQobuzissimes}
<div class="skeleton-section">
<div class="skeleton-title"></div>
<div class="skeleton-row">
{#each { length: 6 } as _}<div class="skeleton-card"></div>{/each}
</div>
</div>
{:else if qobuzissimes.length > 0}
<HorizontalScrollRow title={$t('home.qobuzissimes')}> <HorizontalScrollRow title={$t('home.qobuzissimes')}>
{#snippet children()} {#snippet children()}
{#each qobuzissimes as album} {#each qobuzissimes as album}
@@ -1126,8 +1016,17 @@
{/snippet} {/snippet}
</HorizontalScrollRow> </HorizontalScrollRow>
{/if} {/if}
{/if}
{#if sectionId === 'editorPicks' && editorPicks.length > 0} {#if sectionId === 'editorPicks'}
{#if loadingEditorPicks}
<div class="skeleton-section">
<div class="skeleton-title"></div>
<div class="skeleton-row">
{#each { length: 6 } as _}<div class="skeleton-card"></div>{/each}
</div>
</div>
{:else if editorPicks.length > 0}
<HorizontalScrollRow title={$t('home.editorPicks')}> <HorizontalScrollRow title={$t('home.editorPicks')}>
{#snippet children()} {#snippet children()}
{#each editorPicks as album} {#each editorPicks as album}
@@ -1158,8 +1057,17 @@
{/snippet} {/snippet}
</HorizontalScrollRow> </HorizontalScrollRow>
{/if} {/if}
{/if}
{#if sectionId === 'qobuzPlaylists' && qobuzPlaylists.length > 0} {#if sectionId === 'qobuzPlaylists'}
{#if loadingQobuzPlaylists}
<div class="skeleton-section">
<div class="skeleton-title"></div>
<div class="skeleton-row">
{#each { length: 5 } as _}<div class="skeleton-card-wide"></div>{/each}
</div>
</div>
{:else if qobuzPlaylists.length > 0}
<HorizontalScrollRow> <HorizontalScrollRow>
{#snippet header()} {#snippet header()}
<h2 class="section-title">{$t('home.qobuzPlaylists')}</h2> <h2 class="section-title">{$t('home.qobuzPlaylists')}</h2>
@@ -1199,8 +1107,17 @@
{/snippet} {/snippet}
</HorizontalScrollRow> </HorizontalScrollRow>
{/if} {/if}
{/if}
{#if sectionId === 'essentialDiscography' && essentialDiscography.length > 0} {#if sectionId === 'essentialDiscography'}
{#if loadingEssentialDiscography}
<div class="skeleton-section">
<div class="skeleton-title"></div>
<div class="skeleton-row">
{#each { length: 6 } as _}<div class="skeleton-card"></div>{/each}
</div>
</div>
{:else if essentialDiscography.length > 0}
<HorizontalScrollRow title={$t('home.essentialDiscography')}> <HorizontalScrollRow title={$t('home.essentialDiscography')}>
{#snippet children()} {#snippet children()}
{#each essentialDiscography as album (album.id)} {#each essentialDiscography as album (album.id)}
@@ -1235,8 +1152,17 @@
{/snippet} {/snippet}
</HorizontalScrollRow> </HorizontalScrollRow>
{/if} {/if}
{/if}
{#if sectionId === 'recentAlbums' && recentAlbums.length > 0} {#if sectionId === 'recentAlbums'}
{#if loadingRecentAlbums}
<div class="skeleton-section">
<div class="skeleton-title"></div>
<div class="skeleton-row">
{#each { length: 6 } as _}<div class="skeleton-card"></div>{/each}
</div>
</div>
{:else if recentAlbums.length > 0}
<HorizontalScrollRow title={$t('home.recentlyPlayed')}> <HorizontalScrollRow title={$t('home.recentlyPlayed')}>
{#snippet children()} {#snippet children()}
{#each recentAlbums as album} {#each recentAlbums as album}
@@ -1267,8 +1193,17 @@
{/snippet} {/snippet}
</HorizontalScrollRow> </HorizontalScrollRow>
{/if} {/if}
{/if}
{#if sectionId === 'continueTracks' && continueTracks.length > 0} {#if sectionId === 'continueTracks'}
{#if loadingContinueTracks}
<div class="skeleton-section">
<div class="skeleton-title"></div>
<div class="skeleton-tracks">
{#each { length: 5 } as _}<div class="skeleton-track"></div>{/each}
</div>
</div>
{:else if continueTracks.length > 0}
<div class="section"> <div class="section">
<div class="section-header"> <div class="section-header">
<h2>{$t('home.continueListening')}</h2> <h2>{$t('home.continueListening')}</h2>
@@ -1298,7 +1233,6 @@
onAlbumClick={track.albumId && onAlbumClick ? () => onAlbumClick(track.albumId!) : undefined} onAlbumClick={track.albumId && onAlbumClick ? () => onAlbumClick(track.albumId!) : undefined}
onPlay={trackBlacklisted ? undefined : () => handleContinueTrackPlay(track, index)} onPlay={trackBlacklisted ? undefined : () => handleContinueTrackPlay(track, index)}
menuActions={trackBlacklisted ? { menuActions={trackBlacklisted ? {
// Only navigation actions for blacklisted tracks
onGoToAlbum: track.albumId && onTrackGoToAlbum ? () => onTrackGoToAlbum(track.albumId!) : undefined, onGoToAlbum: track.albumId && onTrackGoToAlbum ? () => onTrackGoToAlbum(track.albumId!) : undefined,
onGoToArtist: track.artistId && onTrackGoToArtist ? () => onTrackGoToArtist(track.artistId!) : undefined, onGoToArtist: track.artistId && onTrackGoToArtist ? () => onTrackGoToArtist(track.artistId!) : undefined,
onShowInfo: onTrackShowInfo ? () => onTrackShowInfo(track.id) : undefined onShowInfo: onTrackShowInfo ? () => onTrackShowInfo(track.id) : undefined
@@ -1322,8 +1256,17 @@
</div> </div>
</div> </div>
{/if} {/if}
{/if}
{#if sectionId === 'topArtists' && topArtists.length > 0} {#if sectionId === 'topArtists'}
{#if loadingTopArtists}
<div class="skeleton-section">
<div class="skeleton-title"></div>
<div class="skeleton-row">
{#each { length: 6 } as _}<div class="skeleton-artist"></div>{/each}
</div>
</div>
{:else if topArtists.length > 0}
<HorizontalScrollRow title={$t('home.yourTopArtists')}> <HorizontalScrollRow title={$t('home.yourTopArtists')}>
{#snippet children()} {#snippet children()}
{#each topArtists as artist} {#each topArtists as artist}
@@ -1353,8 +1296,17 @@
{/snippet} {/snippet}
</HorizontalScrollRow> </HorizontalScrollRow>
{/if} {/if}
{/if}
{#if sectionId === 'favoriteAlbums' && favoriteAlbums.length > 0} {#if sectionId === 'favoriteAlbums'}
{#if loadingFavoriteAlbums}
<div class="skeleton-section">
<div class="skeleton-title"></div>
<div class="skeleton-row">
{#each { length: 6 } as _}<div class="skeleton-card"></div>{/each}
</div>
</div>
{:else if favoriteAlbums.length > 0}
<HorizontalScrollRow title={$t('home.moreFromFavorites')}> <HorizontalScrollRow title={$t('home.moreFromFavorites')}>
{#snippet children()} {#snippet children()}
{#each favoriteAlbums as album} {#each favoriteAlbums as album}
@@ -1385,8 +1337,11 @@
{/snippet} {/snippet}
</HorizontalScrollRow> </HorizontalScrollRow>
{/if} {/if}
{/each} {/if}
{:else} {/each}
<!-- Empty state: only show after all loading completes with no content -->
{#if !anyLoading && !hasContent && !error}
<div class="home-state"> <div class="home-state">
<div class="state-icon"> <div class="state-icon">
<Music size={48} /> <Music size={48} />
@@ -1443,61 +1398,71 @@
background: var(--text-muted); background: var(--text-muted);
} }
/* Loading Overlay */ /* Skeleton loading placeholders */
.loading-overlay { .skeleton-section {
position: fixed;
top: 0;
/* left is set dynamically via inline style based on sidebar state */
right: 0;
bottom: calc(var(--player-bar-height, 104px));
z-index: 10;
background: var(--bg-primary);
display: flex;
align-items: center;
justify-content: center;
transition: opacity 300ms ease-out, left 200ms ease;
}
.loading-overlay.fade-out {
opacity: 0;
pointer-events: none;
}
.loading-content {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; gap: 16px;
gap: 12px;
text-align: center;
} }
.loading-icon { .skeleton-title {
width: 64px; width: 180px;
height: 64px; height: 22px;
border-radius: 16px; background: var(--bg-tertiary);
background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary, #6366f1) 100%); border-radius: 6px;
animation: skeleton-pulse 1.5s ease-in-out infinite;
}
.skeleton-row {
display: flex; display: flex;
align-items: center; gap: 16px;
justify-content: center; overflow: hidden;
color: white;
} }
.loading-content h2 { .skeleton-card {
font-size: 24px; width: 180px;
font-weight: 600; height: 240px;
color: var(--text-primary); background: var(--bg-tertiary);
margin: 0; border-radius: 12px;
flex-shrink: 0;
animation: skeleton-pulse 1.5s ease-in-out infinite;
} }
.loading-content p { .skeleton-card-wide {
font-size: 15px; width: 260px;
color: var(--text-muted); height: 180px;
margin: 0; background: var(--bg-tertiary);
max-width: 360px; border-radius: 12px;
flex-shrink: 0;
animation: skeleton-pulse 1.5s ease-in-out infinite;
} }
.loading-icon :global(.spinner) { .skeleton-artist {
animation: spin 1s linear infinite; width: 180px;
height: 220px;
background: var(--bg-tertiary);
border-radius: 12px;
flex-shrink: 0;
animation: skeleton-pulse 1.5s ease-in-out infinite;
}
.skeleton-tracks {
display: flex;
flex-direction: column;
gap: 4px;
}
.skeleton-track {
width: 100%;
height: 40px;
background: var(--bg-tertiary);
border-radius: 8px;
animation: skeleton-pulse 1.5s ease-in-out infinite;
}
@keyframes skeleton-pulse {
0%, 100% { opacity: 0.4; }
50% { opacity: 0.7; }
} }
.home-header { .home-header {
@@ -1698,15 +1663,6 @@
color: var(--text-muted); color: var(--text-muted);
} }
.state-icon.loading {
background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary, #6366f1) 100%);
color: white;
}
.state-icon :global(.spinner) {
animation: spin 1s linear infinite;
}
@keyframes spin { @keyframes spin {
from { transform: rotate(0deg); } from { transform: rotate(0deg); }
to { transform: rotate(360deg); } to { transform: rotate(360deg); }
-1
View File
@@ -2999,7 +2999,6 @@
onPlaylistShareQobuz={sharePlaylistQobuzLinkById} onPlaylistShareQobuz={sharePlaylistQobuzLinkById}
activeTrackId={currentTrack?.id ?? null} activeTrackId={currentTrack?.id ?? null}
isPlaybackActive={isPlaying} isPlaybackActive={isPlaying}
sidebarExpanded={sidebarExpanded}
/> />
{/if} {/if}
{:else if activeView === 'search'} {:else if activeView === 'search'}