package templates import ( "github.com/maid-zone/soundcloak/lib/sc" "net/url" "strconv" "strings" "github.com/maid-zone/soundcloak/lib/cfg" ) templ UserHeader(u sc.User) { } templ UserItem(user *sc.User) { if user.Avatar != "" { } else { }

{ user.Username }

if user.FullName != "" { { user.FullName } }
} templ UserBase(prefs cfg.Preferences, u sc.User) {
if u.Avatar != "" { }

{ u.Username }

if u.FullName != "" {

{ u.FullName }

} if u.Verified {

Verified

}
if u.Description != "" { @Description(prefs, u.Description) }

{ strconv.FormatInt(u.Followers, 10) } followers

{ strconv.FormatInt(u.Following, 10) } following

{ strconv.FormatInt(u.Tracks, 10) } tracks

{ strconv.FormatInt(u.Playlists, 10) } playlists & albums


Created: { u.CreatedAt }

Last modified: { u.LastModified }

} templ User(prefs cfg.Preferences, u sc.User, p *sc.Paginated[*sc.Track]) { @UserBase(prefs, u) // kinda tedious but whatever, might make it more flexible in the future
tracks playlists albums reposts view on soundcloud

if len(p.Collection) != 0 {
for _, track := range p.Collection { @TrackItem(track, false) }
if p.Next != "" && len(p.Collection) != int(u.Tracks) { more tracks } } else { no more tracks } } templ UserPlaylists(prefs cfg.Preferences, u sc.User, p *sc.Paginated[*sc.Playlist]) { @UserBase(prefs, u)
tracks playlists albums reposts view on soundcloud

if len(p.Collection) != 0 {
for _, playlist := range p.Collection { @PlaylistItem(playlist, false) }
if p.Next != "" && len(p.Collection) != int(p.Total) { more playlists } } else { no more playlists } } templ UserAlbums(prefs cfg.Preferences, u sc.User, p *sc.Paginated[*sc.Playlist]) { @UserBase(prefs, u)
tracks playlists albums reposts view on soundcloud

if len(p.Collection) != 0 {
for _, playlist := range p.Collection { @PlaylistItem(playlist, false) }
if p.Next != "" && len(p.Collection) != int(p.Total) { more albums } } else { no more albums } } templ UserReposts(prefs cfg.Preferences, u sc.User, p *sc.Paginated[*sc.Repost]) { @UserBase(prefs, u)
tracks playlists albums reposts view on soundcloud

if len(p.Collection) != 0 {
for _, repost := range p.Collection { if repost.Type == sc.TrackRepost && repost.Track != nil { @TrackItem(repost.Track, true) } else if repost.Type == sc.PlaylistRepost && repost.Playlist != nil { @PlaylistItem(repost.Playlist, true) } }
if p.Next != "" && len(p.Collection) != int(p.Total) { more reposts } } else { no more reposts } } templ SearchUsers(p *sc.Paginated[*sc.User]) { Found { strconv.FormatInt(p.Total, 10) } users

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

no more results

} } else { for _, user := range p.Collection { @UserItem(user) } if p.Next != "" && len(p.Collection) != int(p.Total) { more users } } }