feat(ui): add Play Artist's Top Songs button (#4204)

* ui: add Play button to artist toolbar

* refactor

Signed-off-by: Deluan <deluan@navidrome.org>

* test(ui): add tests for Play button functionality in ArtistActions

Signed-off-by: Deluan <deluan@navidrome.org>

* ui: update Play button label to Top Songs in ArtistActions

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Deluan <deluan@navidrome.org>
This commit is contained in:
Deluan Quintão
2025-06-09 19:07:42 -04:00
committed by Deluan
parent aee2a1f8be
commit a65140b965
8 changed files with 241 additions and 77 deletions
-1
View File
@@ -3,4 +3,3 @@ export * from './intersperse'
export * from './notifications'
export * from './openInNewTab'
export * from './urls'
export * from './playSimilar'
-27
View File
@@ -1,27 +0,0 @@
import subsonic from '../subsonic'
import { playTracks } from '../actions'
export const playSimilar = async (dispatch, notify, id) => {
const res = await subsonic.getSimilarSongs2(id, 100)
const data = res.json['subsonic-response']
if (data.status !== 'ok') {
throw new Error(
`Error fetching similar songs: ${data.error?.message || 'Unknown error'} (Code: ${data.error?.code || 'unknown'})`,
)
}
const songs = data.similarSongs2?.song || []
if (!songs.length) {
notify('message.noSimilarSongsFound', 'warning')
return
}
const songData = {}
const ids = []
songs.forEach((s) => {
songData[s.id] = s
ids.push(s.id)
})
dispatch(playTracks(songData, ids))
}