Add page for all songs

This commit is contained in:
Jakob Moser 2025-11-13 19:41:24 +01:00
parent fda41d1bdd
commit 008ec35176
Signed by: jakob
GPG Key ID: 3EF2BA2851B3F53C

View File

@ -0,0 +1,23 @@
import Base from "./Base.js"
import SongList from "../pieces/SongList.js"
import Song from "../../model/Song.js"
import search from "../../model/search.js"
export default {
oncreate() {
document.title = "Alle Songs · Karaokatalog"
},
oninit() {
Song.load()
},
view() {
const songs = search.apply(Song.all)
const message = !songs ? "Lade Songs..." : songs.length === 0 ? "Keine Songs gefunden." : null
return m(
Base,
message && m("p", message),
songs && m(SongList, { songs })
)
},
}