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:
parent
a74e9d8c4d
commit
4fd35ec1f0
3 changed files with 6 additions and 1 deletions
|
|
@ -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={() => {
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ export interface Album {
|
|||
appleMusicId?: string
|
||||
highResArtwork?: string
|
||||
previewUrl?: string
|
||||
url?: string
|
||||
genres?: string[]
|
||||
releaseDate?: string
|
||||
trackCount?: number
|
||||
|
|
|
|||
Loading…
Reference in a new issue