( queue: Queue | null, )
| 19 | }; |
| 20 | |
| 21 | const deriveCurrentTrack = ( |
| 22 | queue: Queue | null, |
| 23 | ): { track: CurrentTrack; isLoading: boolean } | undefined => { |
| 24 | if (!queue || queue.items.length === 0) { |
| 25 | return undefined; |
| 26 | } |
| 27 | |
| 28 | const item = queue.items[queue.currentIndex]; |
| 29 | if (!item) { |
| 30 | return undefined; |
| 31 | } |
| 32 | |
| 33 | return { |
| 34 | track: { |
| 35 | title: item.track.title, |
| 36 | artist: item.track.artists[0]?.name, |
| 37 | coverUrl: pickArtwork(item.track.artwork, 'cover', 208)?.url, |
| 38 | }, |
| 39 | isLoading: item.status === 'loading', |
| 40 | }; |
| 41 | }; |
| 42 | |
| 43 | const derivePlayback = (playback: PlaybackState | null) => { |
| 44 | const elapsed = playback?.seek ?? 0; |
no test coverage detected