package templates import ( "git.maid.zone/stuff/soundcloak/lib/sc" "strconv" ) templ PlaylistOrUserItem(pl *sc.PlaylistOrUser) { {{ img := pl.Artwork if pl.Kind == "user" { img = pl.Avatar } if img == "" { img = "/_/static/placeholder.jpg" } }}
if pl.Kind == "user" {

{ pl.Username }

if pl.FullName != "" { { pl.FullName } } } else {

{ pl.Title }

{ strconv.FormatInt(pl.TrackCount, 10) } tracks

}
} templ Discover(p *sc.Paginated[*sc.Selection]) {

Discover Playlists

// also tracks apparently? haven't seen any Got { strconv.FormatInt(int64(len(p.Collection)), 10) } selections if len(p.Collection) != 0 { for _, selection := range p.Collection { // skip so we don't just include the title and zero playlists with it if len(selection.Items.Collection) == 0 { {{ continue }} // raw go code my beloved }

{selection.Title}

for _, pl := range selection.Items.Collection { @PlaylistOrUserItem(pl) } } // I don't think they have pagination for this endpoint, just leaving this here, in case they actually do // if p.Next != "" { // more playlists // } } }