Files
soundcloak/templates/featured.templ
2025-04-16 21:08:20 +03:00

31 lines
982 B
Plaintext

package templates
import (
"git.maid.zone/stuff/soundcloak/lib/sc"
"strconv"
)
templ Discover(p *sc.Paginated[*sc.Selection]) {
<h1>Discover Playlists</h1> // also tracks apparently? haven't seen any
<span>Got { strconv.FormatInt(int64(len(p.Collection)), 10) } selections</span>
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
}
<h2>{selection.Title}</h2>
for _, pl := range selection.Items.Collection {
// We don't need the username
@PlaylistItem(pl, false)
}
}
// I don't think they have pagination for this endpoint, just leaving this here, in case they actually do
// if p.Next != "" {
// <a class="btn" href={ templ.URL("/discover?pagination=" + url.QueryEscape(strings.Split(p.Next, "/discover")[1])) } rel="noreferrer">more playlists</a>
// }
}
}