refactor: extract Qobuz adapters and unify DisplayTrack type

- Create $lib/adapters/qobuzAdapters.ts with:
  - formatDuration/formatDurationMinutes (removed duplicates)
  - getQobuzImage helper
  - formatQuality/formatAlbumQuality helpers
  - convertQobuzAlbum converter
  - convertQobuzArtist converter

- Add unified DisplayTrack type to $lib/types/index.ts

- Update +page.svelte:
  - Import adapters instead of inline functions
  - Remove duplicate converter functions (−57 lines)
  - Add handleDisplayTrackPlay for view components

- Fix TypeScript type narrowing in view closures
This commit is contained in:
vicrodh committed 2026-01-10 05:51:48 -06:00
1 parent 30a33cfc95
commit 5be437dd4e
7 files changed
+190 -85

No files matched your search

@@ -247,7 +247,7 @@
onShareQobuz: onTrackShareQobuz ? () => onTrackShareQobuz(track.id) : undefined,
onShareSonglink: onTrackShareSonglink ? () => onTrackShareSonglink(track) : undefined,
onGoToAlbum: onTrackGoToAlbum ? () => onTrackGoToAlbum(album.id) : undefined,
onGoToArtist: album.artistId && onTrackGoToArtist ? () => onTrackGoToArtist(album.artistId) : undefined
onGoToArtist: album.artistId && onTrackGoToArtist ? () => onTrackGoToArtist(album.artistId!) : undefined
}}
/>
{/each}