}
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
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)
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)
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)