Add SongList

This commit is contained in:
Jakob Moser 2025-11-13 19:47:51 +01:00
parent 0b69162d0b
commit 7c6ba261f8
Signed by: jakob
GPG Key ID: 3EF2BA2851B3F53C

View File

@ -0,0 +1,11 @@
import Artist from "./Artist.js"
import Pagination from "./Pagination.js"
export default {
view: function (vnode) {
const sortedSongs = vnode.attrs.songs.toSorted((a, b) => a.artist.localeCompare(b.artist) || a.title.localeCompare(b.title))
const songsByArtist = Map.groupBy(sortedSongs, song => song.artist)
return m(Pagination, { elements: songsByArtist.entries().map(([artist, songs]) => m(Artist, { artist, songs })) })
},
}