feat(ux): increase artist album limits and add Others section
- Increase artist detail album fetch from 100 to 500 - Increase bio truncation from 300 to 500 chars - Add Others category for greatest hits/anthologies - Add configurable limits for Home sections - Update HomeSettingsModal with limits grid UI cp
This commit is contained in:
1 parent
dd9eb90343
commit
bf4050a592
7 files changed
+247
-20
No files matched your search
@@ -11,6 +11,7 @@
|
||||
setGreetingEnabled,
|
||||
setCustomGreeting,
|
||||
resetToDefaults,
|
||||
updateLimit,
|
||||
type HomeSettings
|
||||
} from '$lib/stores/homeSettingsStore';
|
||||
import { t } from '$lib/i18n';
|
||||
@@ -57,6 +58,10 @@
|
||||
function handleReset() {
|
||||
resetToDefaults();
|
||||
}
|
||||
|
||||
function handleLimitChange(key: keyof HomeSettings['limits'], value: number) {
|
||||
updateLimit(key, value);
|
||||
}
|
||||
</script>
|
||||
|
||||
<Modal {isOpen} {onClose} title={$t('home.customizeHome')}>
|
||||
@@ -98,6 +103,92 @@
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<!-- Item Limits -->
|
||||
<div class="settings-section">
|
||||
<div class="section-title">Item Limits</div>
|
||||
<p class="section-desc">Configure how many items to show in each section</p>
|
||||
|
||||
<div class="limits-grid">
|
||||
<div class="limit-item">
|
||||
<label class="limit-label" for="limit-recent">Recently Played</label>
|
||||
<input
|
||||
id="limit-recent"
|
||||
type="number"
|
||||
class="limit-input"
|
||||
min="1"
|
||||
max="100"
|
||||
value={settings.limits.recentAlbums}
|
||||
onchange={(e) => handleLimitChange('recentAlbums', Number(e.currentTarget.value))}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="limit-item">
|
||||
<label class="limit-label" for="limit-continue">Continue Listening</label>
|
||||
<input
|
||||
id="limit-continue"
|
||||
type="number"
|
||||
class="limit-input"
|
||||
min="1"
|
||||
max="100"
|
||||
value={settings.limits.continueTracks}
|
||||
onchange={(e) => handleLimitChange('continueTracks', Number(e.currentTarget.value))}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="limit-item">
|
||||
<label class="limit-label" for="limit-artists">Top Artists</label>
|
||||
<input
|
||||
id="limit-artists"
|
||||
type="number"
|
||||
class="limit-input"
|
||||
min="1"
|
||||
max="100"
|
||||
value={settings.limits.topArtists}
|
||||
onchange={(e) => handleLimitChange('topArtists', Number(e.currentTarget.value))}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="limit-item">
|
||||
<label class="limit-label" for="limit-fav-albums">Favorite Albums</label>
|
||||
<input
|
||||
id="limit-fav-albums"
|
||||
type="number"
|
||||
class="limit-input"
|
||||
min="1"
|
||||
max="100"
|
||||
value={settings.limits.favoriteAlbums}
|
||||
onchange={(e) => handleLimitChange('favoriteAlbums', Number(e.currentTarget.value))}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="limit-item">
|
||||
<label class="limit-label" for="limit-fav-tracks">Favorite Tracks</label>
|
||||
<input
|
||||
id="limit-fav-tracks"
|
||||
type="number"
|
||||
class="limit-input"
|
||||
min="1"
|
||||
max="100"
|
||||
value={settings.limits.favoriteTracks}
|
||||
onchange={(e) => handleLimitChange('favoriteTracks', Number(e.currentTarget.value))}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="limit-item">
|
||||
<label class="limit-label" for="limit-featured">Featured Albums</label>
|
||||
<input
|
||||
id="limit-featured"
|
||||
type="number"
|
||||
class="limit-input"
|
||||
min="1"
|
||||
max="100"
|
||||
value={settings.limits.featuredAlbums}
|
||||
onchange={(e) => handleLimitChange('featuredAlbums', Number(e.currentTarget.value))}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Sections Order -->
|
||||
<div class="settings-section">
|
||||
<div class="section-title">{$t('homeSettings.sections')}</div>
|
||||
@@ -388,4 +479,41 @@
|
||||
border-color: var(--text-muted);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.limits-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.limit-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.limit-label {
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.limit-input {
|
||||
padding: 8px 12px;
|
||||
background: var(--bg-secondary);
|
||||
border: 1px solid var(--bg-tertiary);
|
||||
border-radius: 6px;
|
||||
color: var(--text-primary);
|
||||
font-size: 13px;
|
||||
transition: all 150ms ease;
|
||||
}
|
||||
|
||||
.limit-input:focus {
|
||||
outline: none;
|
||||
border-color: var(--accent);
|
||||
}
|
||||
|
||||
.limit-input:hover {
|
||||
border-color: var(--text-muted);
|
||||
}
|
||||
</style>
|
||||
@@ -114,6 +114,7 @@
|
||||
let epsSinglesSection = $state<HTMLDivElement | null>(null);
|
||||
let liveAlbumsSection = $state<HTMLDivElement | null>(null);
|
||||
let compilationsSection = $state<HTMLDivElement | null>(null);
|
||||
let othersSection = $state<HTMLDivElement | null>(null);
|
||||
let playlistsSection = $state<HTMLDivElement | null>(null);
|
||||
let activeJumpSection = $state('about');
|
||||
let jumpObserver: IntersectionObserver | null = null;
|
||||
@@ -149,7 +150,8 @@
|
||||
...artist.albums,
|
||||
...artist.epsSingles,
|
||||
...artist.liveAlbums,
|
||||
...artist.compilations
|
||||
...artist.compilations,
|
||||
...artist.others
|
||||
];
|
||||
loadAllAlbumDownloadStatuses(allAlbums);
|
||||
}
|
||||
@@ -185,7 +187,8 @@
|
||||
...artist.albums,
|
||||
...artist.epsSingles,
|
||||
...artist.liveAlbums,
|
||||
...artist.compilations
|
||||
...artist.compilations,
|
||||
...artist.others
|
||||
];
|
||||
await loadAllAlbumDownloadStatuses(allAlbums);
|
||||
}
|
||||
@@ -339,7 +342,7 @@
|
||||
|
||||
// Truncate bio for collapsed view
|
||||
let truncatedBio = $derived(
|
||||
bioText && bioText.length > 300 ? bioText.slice(0, 300) + '...' : bioText
|
||||
bioText && bioText.length > 500 ? bioText.slice(0, 500) + '...' : bioText
|
||||
);
|
||||
|
||||
let hasMoreAlbums = $derived(!!onLoadMore && artist.albumsFetched < artist.totalAlbums);
|
||||
@@ -347,6 +350,7 @@
|
||||
let hasEpsSingles = $derived(artist.epsSingles.length > 0);
|
||||
let hasLiveAlbums = $derived(artist.liveAlbums.length > 0);
|
||||
let hasCompilations = $derived(artist.compilations.length > 0);
|
||||
let hasOthers = $derived(artist.others.length > 0);
|
||||
let hasPlaylists = $derived(artist.playlists.length > 0);
|
||||
let jumpSections = $derived.by(() => [
|
||||
{ id: 'about', label: 'About', el: aboutSection, visible: true },
|
||||
@@ -355,6 +359,7 @@
|
||||
{ id: 'eps', label: 'EPs & Singles', el: epsSinglesSection, visible: hasEpsSingles },
|
||||
{ id: 'live', label: 'Live Albums', el: liveAlbumsSection, visible: hasLiveAlbums },
|
||||
{ id: 'compilations', label: 'Compilations', el: compilationsSection, visible: hasCompilations },
|
||||
{ id: 'others', label: 'Others', el: othersSection, visible: hasOthers },
|
||||
{ id: 'playlists', label: 'Playlists', el: playlistsSection, visible: hasPlaylists },
|
||||
].filter(section => section.visible));
|
||||
|
||||
@@ -747,6 +752,36 @@
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if artist.others.length > 0}
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="discography section-anchor" bind:this={othersSection}>
|
||||
<h2 class="section-title">Others</h2>
|
||||
<div class="albums-grid">
|
||||
{#each artist.others as album}
|
||||
<AlbumCard
|
||||
albumId={album.id}
|
||||
artwork={album.artwork}
|
||||
title={album.title}
|
||||
artist={album.year || ''}
|
||||
quality={album.quality}
|
||||
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)}
|
||||
onOpenContainingFolder={onOpenAlbumFolder ? () => onOpenAlbumFolder(album.id) : undefined}
|
||||
onReDownloadAlbum={onReDownloadAlbum ? () => onReDownloadAlbum(album.id) : undefined}
|
||||
{downloadStateVersion}
|
||||
onclick={() => { onAlbumClick?.(album.id); loadAlbumDownloadStatus(album.id); }}
|
||||
/>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if artist.playlists.length > 0}
|
||||
<div class="divider"></div>
|
||||
|
||||
|
||||
@@ -107,6 +107,8 @@
|
||||
featuredAlbums: 12
|
||||
};
|
||||
|
||||
let homeLimits = $state(getSettings().limits);
|
||||
|
||||
// Loading states for progressive render
|
||||
let isInitializing = $state(true);
|
||||
let isOverlayVisible = $state(true); // Overlay that fades out when ALL sections ready
|
||||
@@ -215,6 +217,7 @@
|
||||
// Subscribe to home settings changes
|
||||
const unsubscribe = subscribeHomeSettings(() => {
|
||||
homeSettings = getSettings();
|
||||
homeLimits = getSettings().limits;
|
||||
});
|
||||
|
||||
// Load home data
|
||||
@@ -341,7 +344,7 @@
|
||||
return Array.from(counts.entries())
|
||||
.map(([artistId, playCount]) => ({ artistId, playCount }))
|
||||
.sort((a, b) => b.playCount - a.playCount)
|
||||
.slice(0, LIMITS.topArtists);
|
||||
.slice(0, homeLimits.topArtists);
|
||||
}
|
||||
|
||||
async function loadHome() {
|
||||
@@ -373,15 +376,15 @@
|
||||
|
||||
// Start ML data loading FIRST (local SQLite) - this gets the seeds
|
||||
const mlPromise = invoke<HomeSeeds>('reco_get_home_ml', {
|
||||
limitRecentAlbums: LIMITS.recentAlbums,
|
||||
limitContinueTracks: LIMITS.continueTracks,
|
||||
limitTopArtists: LIMITS.topArtists,
|
||||
limitFavorites: Math.max(LIMITS.favoriteAlbums, LIMITS.favoriteTracks)
|
||||
limitRecentAlbums: homeLimits.recentAlbums,
|
||||
limitContinueTracks: homeLimits.continueTracks,
|
||||
limitTopArtists: homeLimits.topArtists,
|
||||
limitFavorites: Math.max(homeLimits.favoriteAlbums, homeLimits.favoriteTracks)
|
||||
});
|
||||
|
||||
// Start Qobuz API calls in parallel (don't await)
|
||||
if (isSectionVisible('newReleases')) {
|
||||
fetchFeaturedAlbums('new-releases', LIMITS.featuredAlbums).then(async albums => {
|
||||
fetchFeaturedAlbums('new-releases', homeLimits.featuredAlbums).then(async albums => {
|
||||
newReleases = albums;
|
||||
await loadAllAlbumDownloadStatuses(albums);
|
||||
loadingNewReleases = false;
|
||||
@@ -392,7 +395,7 @@
|
||||
}
|
||||
|
||||
if (isSectionVisible('pressAwards')) {
|
||||
fetchFeaturedAlbums('press-awards', LIMITS.featuredAlbums).then(async albums => {
|
||||
fetchFeaturedAlbums('press-awards', homeLimits.featuredAlbums).then(async albums => {
|
||||
pressAwards = albums;
|
||||
await loadAllAlbumDownloadStatuses(albums);
|
||||
loadingPressAwards = false;
|
||||
@@ -403,7 +406,7 @@
|
||||
}
|
||||
|
||||
if (isSectionVisible('mostStreamed')) {
|
||||
fetchFeaturedAlbums('most-streamed', LIMITS.featuredAlbums).then(async albums => {
|
||||
fetchFeaturedAlbums('most-streamed', homeLimits.featuredAlbums).then(async albums => {
|
||||
mostStreamed = albums;
|
||||
await loadAllAlbumDownloadStatuses(albums);
|
||||
loadingMostStreamed = false;
|
||||
@@ -414,7 +417,7 @@
|
||||
}
|
||||
|
||||
if (isSectionVisible('qobuzissimes')) {
|
||||
fetchFeaturedAlbums('qobuzissimes', LIMITS.featuredAlbums).then(async albums => {
|
||||
fetchFeaturedAlbums('qobuzissimes', homeLimits.featuredAlbums).then(async albums => {
|
||||
qobuzissimes = albums;
|
||||
await loadAllAlbumDownloadStatuses(albums);
|
||||
loadingQobuzissimes = false;
|
||||
@@ -425,7 +428,7 @@
|
||||
}
|
||||
|
||||
if (isSectionVisible('editorPicks')) {
|
||||
fetchFeaturedAlbums('editor-picks', LIMITS.featuredAlbums).then(async albums => {
|
||||
fetchFeaturedAlbums('editor-picks', homeLimits.featuredAlbums).then(async albums => {
|
||||
editorPicks = albums;
|
||||
await loadAllAlbumDownloadStatuses(albums);
|
||||
loadingEditorPicks = false;
|
||||
@@ -454,7 +457,7 @@
|
||||
// Recently Played (albums) - start immediately with seeds
|
||||
if (isSectionVisible('recentAlbums')) {
|
||||
const recentAlbumIds = normalizeAlbumIds(seeds.recentlyPlayedAlbumIds);
|
||||
fetchAlbums(recentAlbumIds.slice(0, LIMITS.recentAlbums)).then(async albums => {
|
||||
fetchAlbums(recentAlbumIds.slice(0, homeLimits.recentAlbums)).then(async albums => {
|
||||
recentAlbums = albums;
|
||||
await loadAllAlbumDownloadStatuses(albums);
|
||||
loadingRecentAlbums = false;
|
||||
@@ -466,7 +469,7 @@
|
||||
|
||||
// Top Artists
|
||||
if (isSectionVisible('topArtists')) {
|
||||
fetchArtists(seeds.topArtistIds.slice(0, LIMITS.topArtists)).then(artists => {
|
||||
fetchArtists(seeds.topArtistIds.slice(0, homeLimits.topArtists)).then(artists => {
|
||||
topArtists = artists;
|
||||
loadingTopArtists = false;
|
||||
markSectionFinished();
|
||||
@@ -478,12 +481,12 @@
|
||||
// Favorite Albums
|
||||
if (isSectionVisible('favoriteAlbums')) {
|
||||
// Get favorite track details to extract album IDs
|
||||
fetchTracks(seeds.favoriteTrackIds.slice(0, LIMITS.favoriteTracks)).then(async favoriteTrackDetails => {
|
||||
fetchTracks(seeds.favoriteTrackIds.slice(0, homeLimits.favoriteTracks)).then(async favoriteTrackDetails => {
|
||||
const favoriteAlbumIds = normalizeAlbumIds([
|
||||
...seeds.favoriteAlbumIds,
|
||||
...favoriteTrackDetails.map(track => track.albumId)
|
||||
]);
|
||||
const albums = await fetchAlbums(favoriteAlbumIds.slice(0, LIMITS.favoriteAlbums));
|
||||
const albums = await fetchAlbums(favoriteAlbumIds.slice(0, homeLimits.favoriteAlbums));
|
||||
favoriteAlbums = albums;
|
||||
await loadAllAlbumDownloadStatuses(albums);
|
||||
loadingFavoriteAlbums = false;
|
||||
|
||||
Reference in new issue
Block a user