feat: link albums to Apple Music when available

- Add URL field to Apple Music data type
- Include Apple Music URL in album transformation
- Prioritize Apple Music links over Last.fm in Album component
- Falls back to Last.fm URL when Apple Music data unavailable

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Justin Edmund 2025-07-11 20:12:13 -07:00
parent a74e9d8c4d
commit 4fd35ec1f0
3 changed files with 6 additions and 1 deletions

View file

@ -102,6 +102,9 @@
const isNowPlaying = $derived(album?.isNowPlaying ?? false)
const nowPlayingTrack = $derived(album?.nowPlayingTrack)
// Use Apple Music URL if available, otherwise fall back to Last.fm
const albumUrl = $derived(album?.appleMusicData?.url || album?.url || '#')
// Debug logging
$effect(() => {
if (album && (isNowPlaying || album.isNowPlaying)) {
@ -118,7 +121,7 @@
{#if album}
<div class="album-wrapper">
<a
href={album.url}
href={albumUrl}
target="_blank"
rel="noopener noreferrer"
onmouseenter={() => {

View file

@ -508,6 +508,7 @@ export async function transformAlbumData(appleMusicAlbum: AppleMusicAlbum) {
? attributes.artwork.url.replace('{w}x{h}', '3000x3000')
: undefined,
previewUrl,
url: attributes.url,
// Store additional metadata for future use
genres: attributes.genreNames,
releaseDate: attributes.releaseDate,

View file

@ -33,6 +33,7 @@ export interface Album {
appleMusicId?: string
highResArtwork?: string
previewUrl?: string
url?: string
genres?: string[]
releaseDate?: string
trackCount?: number