feat(album): circular buttons and full release date

Header buttons:
- Play button: circular 44px with accent background (primary action)
- Shuffle button: circular 36px with outline (secondary)
- Favorite button: circular 36px with outline, highlight when active

Release date:
- Added releaseDate field to AlbumDetail type
- Adapter now includes full release_date_original from Qobuz API
- Display formatted date (e.g., "January 15, 2024") with year fallback
This commit is contained in:
vicrodh committed 2026-01-24 11:07:29 -06:00
1 parent b296d3091b
commit bc2491cb95
3 files changed
+74 -64

No files matched your search

+1
View File
@@ -323,6 +323,7 @@ export function convertQobuzAlbum(album: QobuzAlbum): AlbumDetail {
artist: album.artist?.name || 'Unknown Artist', artist: album.artist?.name || 'Unknown Artist',
artistId: album.artist?.id, artistId: album.artist?.id,
year: album.release_date_original?.split('-')[0] || '', year: album.release_date_original?.split('-')[0] || '',
releaseDate: album.release_date_original,
label: album.label?.name || '', label: album.label?.name || '',
genre: album.genre?.name || '', genre: album.genre?.name || '',
quality, quality,
+72 -64
View File
@@ -34,6 +34,7 @@
artist: string; artist: string;
artistId?: number; artistId?: number;
year: string; year: string;
releaseDate?: string;
label: string; label: string;
genre: string; genre: string;
quality: string; quality: string;
@@ -105,7 +106,6 @@
let isFavorite = $state(false); let isFavorite = $state(false);
let isFavoriteLoading = $state(false); let isFavoriteLoading = $state(false);
let playBtnHovered = $state(false);
let scrollContainer: HTMLDivElement | null = $state(null); let scrollContainer: HTMLDivElement | null = $state(null);
const albumFullyDownloaded = $derived( const albumFullyDownloaded = $derived(
@@ -116,6 +116,21 @@
album.artist?.trim().toLowerCase() === 'various artists' album.artist?.trim().toLowerCase() === 'various artists'
); );
// Format release date nicely, fallback to year
const formattedReleaseDate = $derived.by(() => {
if (album.releaseDate) {
const date = new Date(album.releaseDate);
if (!isNaN(date.getTime())) {
return date.toLocaleDateString('en-US', {
year: 'numeric',
month: 'long',
day: 'numeric'
});
}
}
return album.year;
});
async function scrollToTrack(trackId: number) { async function scrollToTrack(trackId: number) {
await tick(); await tick();
const target = scrollContainer?.querySelector<HTMLElement>(`[data-track-id="${trackId}"]`); const target = scrollContainer?.querySelector<HTMLElement>(`[data-track-id="${trackId}"]`);
@@ -193,30 +208,36 @@
{:else} {:else}
<div class="artist-name">{album.artist}</div> <div class="artist-name">{album.artist}</div>
{/if} {/if}
<div class="album-info">{album.year} • {album.label} • {album.genre}</div> <div class="album-info">{formattedReleaseDate} • {album.label} • {album.genre}</div>
<div class="album-quality">{album.quality}</div> <div class="album-quality">{album.quality}</div>
<div class="album-stats">{album.trackCount} tracks • {album.duration}</div> <div class="album-stats">{album.trackCount} tracks • {album.duration}</div>
<!-- Action Buttons --> <!-- Action Buttons -->
<div class="actions"> <div class="actions">
<button <button
class="play-btn" class="action-btn primary"
style="background-color: {playBtnHovered ? 'var(--accent-hover)' : 'var(--accent-primary)'}"
onmouseenter={() => (playBtnHovered = true)}
onmouseleave={() => (playBtnHovered = false)}
onclick={onPlayAll} onclick={onPlayAll}
title="Play"
> >
<Play size={18} fill="white" color="white" /> <Play size={20} fill="white" color="white" />
<span>Play</span>
</button> </button>
<button class="secondary-btn" onclick={onShuffleAll}> <button
class="action-btn"
onclick={onShuffleAll}
title="Shuffle"
>
<Shuffle size={18} /> <Shuffle size={18} />
<span>Shuffle</span>
</button> </button>
<button class="icon-btn" onclick={toggleFavorite} disabled={isFavoriteLoading}> <button
class="action-btn"
class:is-favorite={isFavorite}
onclick={toggleFavorite}
disabled={isFavoriteLoading}
title={isFavorite ? 'Remove from favorites' : 'Add to favorites'}
>
<Heart <Heart
size={20} size={18}
color={isFavorite ? 'var(--accent-primary)' : 'white'} color={isFavorite ? 'var(--accent-primary)' : 'currentColor'}
fill={isFavorite ? 'var(--accent-primary)' : 'none'} fill={isFavorite ? 'var(--accent-primary)' : 'none'}
/> />
</button> </button>
@@ -227,7 +248,7 @@
onShareQobuz={onShareAlbumQobuz} onShareQobuz={onShareAlbumQobuz}
onShareSonglink={onShareAlbumSonglink} onShareSonglink={onShareAlbumSonglink}
onDownload={onDownloadAlbum} onDownload={onDownloadAlbum}
isAlbumFullyCached={albumFullyDownloaded} isAlbumFullyDownloaded={albumFullyDownloaded}
onOpenContainingFolder={onOpenAlbumFolder} onOpenContainingFolder={onOpenAlbumFolder}
onReDownloadAlbum={onReDownloadAlbum} onReDownloadAlbum={onReDownloadAlbum}
/> />
@@ -417,62 +438,49 @@
gap: 12px; gap: 12px;
} }
.play-btn { .action-btn {
height: 40px;
padding: 0 24px;
border-radius: 8px;
border: none;
display: flex;
align-items: center;
gap: 8px;
cursor: pointer;
transition: background-color 150ms ease;
}
.play-btn span {
font-size: 14px;
font-weight: 500;
color: white;
}
.secondary-btn {
height: 40px;
padding: 0 24px;
border-radius: 8px;
border: 1px solid rgba(255, 255, 255, 0.3);
background: transparent;
display: flex;
align-items: center;
gap: 8px;
color: white;
cursor: pointer;
transition: background-color 150ms ease;
}
.secondary-btn:hover {
background-color: rgba(255, 255, 255, 0.1);
}
.secondary-btn span {
font-size: 14px;
font-weight: 500;
}
.icon-btn {
width: 40px;
height: 40px;
border-radius: 50%;
border: none;
background: transparent;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
width: 36px;
height: 36px;
border-radius: 50%;
border: 1px solid rgba(255, 255, 255, 0.3);
background: transparent;
color: var(--text-muted);
cursor: pointer; cursor: pointer;
transition: background-color 150ms ease; transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
} }
.icon-btn:hover { .action-btn:hover:not(:disabled) {
background-color: rgba(255, 255, 255, 0.1); background: var(--bg-hover);
color: var(--text-primary);
border-color: var(--text-primary);
}
.action-btn:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.action-btn.primary {
width: 44px;
height: 44px;
background: var(--accent-primary);
border: none;
color: white;
box-shadow: 0 0 2px 1px rgba(var(--accent-primary-rgb, 139, 92, 246), 0.3);
}
.action-btn.primary:hover {
background: var(--accent-hover);
box-shadow: 0 0 16px 6px rgba(var(--accent-primary-rgb, 139, 92, 246), 0.5);
}
.action-btn.is-favorite {
background: rgba(var(--accent-primary-rgb, 139, 92, 246), 0.15);
border-color: var(--accent-primary);
color: var(--accent-primary);
} }
.divider { .divider {
+1
View File
@@ -106,6 +106,7 @@ export interface AlbumDetail {
artist: string; artist: string;
artistId?: number; artistId?: number;
year: string; year: string;
releaseDate?: string; // Full date in YYYY-MM-DD format
label: string; label: string;
genre: string; genre: string;
quality: string; quality: string;