package templates import ( "git.maid.zone/stuff/soundcloak/lib/cfg" "git.maid.zone/stuff/soundcloak/lib/sc" "net/url" "strconv" "strings" ) templ PlaylistHeader(p sc.Playlist) { } func playlist(t sc.Track, p sc.Playlist) string { return t.Href() + "?playlist=" + p.Href()[1:] } templ PlaylistItem(playlist *sc.Playlist, showUsername bool) { if playlist.Artwork != "" { } else { }

{ playlist.Title }

if showUsername { { playlist.Author.Username } }

{ strconv.FormatInt(playlist.TracksCount(), 10) } tracks

} templ Playlist(prefs cfg.Preferences, p sc.Playlist) { if p.Artwork != "" { }

{ p.Title }

@UserItem(&p.Author)
view on soundcloud

@Description(prefs, p.Description, nil)

{ strconv.FormatInt(p.TracksCount(), 10) } tracks



for _, track := range p.Tracks { if *prefs.AutoplayNextTrack { @TrackItem(&track, true, playlist(track, p)) } else { @TrackItem(&track, true, "") } }
if len(p.MissingTracks) != 0 { more tracks }
if p.TagList != "" {

Tags: { strings.Join(sc.TagListParser(p.TagList), ", ") }

}

{ strconv.FormatInt(p.Likes, 10) } likes


if p.CreatedAt != "" {

Created: { p.CreatedAt }

} if p.LastModified != "" {

Last modified: { p.LastModified }

}
} templ SearchPlaylists(p *sc.Paginated[*sc.Playlist]) { Found { strconv.FormatInt(p.Total, 10) } playlists

if len(p.Collection) == 0 { if p.Total != 0 {

no more results

} } else { for _, playlist := range p.Collection { @PlaylistItem(playlist, true) } if p.Next != "" && len(p.Collection) != int(p.Total) { more playlists } } }