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 isNowPlaying = $derived(album?.isNowPlaying ?? false)
|
||||||
const nowPlayingTrack = $derived(album?.nowPlayingTrack)
|
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
|
// Debug logging
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
if (album && (isNowPlaying || album.isNowPlaying)) {
|
if (album && (isNowPlaying || album.isNowPlaying)) {
|
||||||
|
|
@ -118,7 +121,7 @@
|
||||||
{#if album}
|
{#if album}
|
||||||
<div class="album-wrapper">
|
<div class="album-wrapper">
|
||||||
<a
|
<a
|
||||||
href={album.url}
|
href={albumUrl}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
onmouseenter={() => {
|
onmouseenter={() => {
|
||||||
|
|
|
||||||
|
|
@ -508,6 +508,7 @@ export async function transformAlbumData(appleMusicAlbum: AppleMusicAlbum) {
|
||||||
? attributes.artwork.url.replace('{w}x{h}', '3000x3000')
|
? attributes.artwork.url.replace('{w}x{h}', '3000x3000')
|
||||||
: undefined,
|
: undefined,
|
||||||
previewUrl,
|
previewUrl,
|
||||||
|
url: attributes.url,
|
||||||
// Store additional metadata for future use
|
// Store additional metadata for future use
|
||||||
genres: attributes.genreNames,
|
genres: attributes.genreNames,
|
||||||
releaseDate: attributes.releaseDate,
|
releaseDate: attributes.releaseDate,
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ export interface Album {
|
||||||
appleMusicId?: string
|
appleMusicId?: string
|
||||||
highResArtwork?: string
|
highResArtwork?: string
|
||||||
previewUrl?: string
|
previewUrl?: string
|
||||||
|
url?: string
|
||||||
genres?: string[]
|
genres?: string[]
|
||||||
releaseDate?: string
|
releaseDate?: string
|
||||||
trackCount?: number
|
trackCount?: number
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue