mirror of
https://git.maid.zone/stuff/soundcloak.git
synced 2026-01-01 00:19:38 +05:00
57 lines
1.5 KiB
Plaintext
57 lines
1.5 KiB
Plaintext
package templates
|
|
|
|
import (
|
|
"github.com/maid-zone/soundcloak/lib/sc"
|
|
"net/url"
|
|
"strconv"
|
|
"strings"
|
|
)
|
|
|
|
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 }/>
|
|
<link rel="icon" type="image/x-icon" href={ 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>
|
|
}
|
|
if u.Verified {
|
|
<p style="color: var(--accent)">Verified</p>
|
|
}
|
|
</div>
|
|
<p style="white-space: pre-wrap">{ u.Description }</p>
|
|
<div>
|
|
<p>{ strconv.FormatInt(u.Followers, 10) } followers</p>
|
|
<p>{ strconv.FormatInt(u.Following, 10) } following</p>
|
|
<p>{ strconv.FormatInt(u.Tracks, 10) } tracks</p>
|
|
<p>{ strconv.FormatInt(u.Playlists, 10) } playlists</p>
|
|
<br/>
|
|
<p>Created: { u.CreatedAt }</p>
|
|
<p>Last modified: { u.LastModified }</p>
|
|
</div>
|
|
if len(p.Collection) != 0 {
|
|
<div>
|
|
for _, track := range p.Collection {
|
|
<a class="listing" href={ templ.URL("/" + track.Author.Permalink + "/" + track.Permalink) }>
|
|
<img src={ track.Artwork }/>
|
|
<div class="meta">
|
|
<h3>{ track.Title }</h3>
|
|
</div>
|
|
</a>
|
|
}
|
|
</div>
|
|
<a href={ templ.URL("?pagination=" + url.QueryEscape(strings.Split(p.Next, "/tracks")[1])) } rel="noreferrer">more tracks</a>
|
|
} else {
|
|
<span>no more tracks</span>
|
|
}
|
|
}
|