mirror of
https://git.maid.zone/stuff/soundcloak.git
synced 2026-01-31 07:49:39 +05:00
57 lines
1.5 KiB
Plaintext
57 lines
1.5 KiB
Plaintext
package templates
|
|
|
|
import (
|
|
"github.com/maid-zone/soundcloak/lib/sc"
|
|
"strconv"
|
|
"strings"
|
|
"net/url"
|
|
)
|
|
|
|
templ UserEmbed(u sc.User) {
|
|
<meta name="og:site_name" content="soundcloak">
|
|
<meta name="og:title" content={u.FormatUsername()}>
|
|
<meta name="og:description" content={u.FormatDescription()}>
|
|
<meta name="og:image" content={u.Avatar}>
|
|
}
|
|
|
|
templ User(u sc.User, p *sc.Paginated[sc.Track]) {
|
|
<div>
|
|
if u.Avatar != "" {
|
|
<img src={u.Avatar}>
|
|
}
|
|
|
|
<h1>{u.Username}</h1>
|
|
if u.FullName != "" {
|
|
<h2>{u.FullName}</h2>
|
|
}
|
|
</div>
|
|
|
|
<p style="white-space: pre-wrap">{u.Description}</p>
|
|
|
|
<div>
|
|
<h2>{strconv.FormatInt(u.Followers, 10)} followers</h2>
|
|
<h2>{strconv.FormatInt(u.Following, 10)} following</h2>
|
|
<h2>{strconv.FormatInt(u.Tracks, 10)} tracks</h2>
|
|
<h2>{strconv.FormatInt(u.Playlists, 10)} playlists</h2>
|
|
<br>
|
|
<h2>Created: {u.CreatedAt}</h2>
|
|
<h2>Last modified: {u.LastModified}</h2>
|
|
if u.Verified {
|
|
<h2>Verified</h2>
|
|
}
|
|
</div>
|
|
|
|
if len(p.Collection) != 0 {
|
|
<div>
|
|
for _, track := range p.Collection {
|
|
<div>
|
|
<h1><a href={templ.URL("/" + track.Author.Permalink + "/" + track.Permalink)}>{track.Title}</a></h1>
|
|
</div>
|
|
}
|
|
</div>
|
|
|
|
<a href={templ.URL("?pagination=" + url.QueryEscape(strings.Split(p.Next, "/tracks")[1]))}>more tracks</a>
|
|
} else {
|
|
<h1>no more tracks</h1>
|
|
}
|
|
} |