Add user to albums
This commit is contained in:
parent
41012edf9e
commit
6e5b0ee127
15
api/album.go
15
api/album.go
|
@ -78,7 +78,7 @@ func ParseAlbum(data gjson.Result) (types.Album, error) {
|
|||
return types.Album{}, err
|
||||
}
|
||||
|
||||
return types.Album{
|
||||
album := types.Album{
|
||||
Id: data.Get("id").String(),
|
||||
Title: data.Get("title").String(),
|
||||
SharedWithCommunity: data.Get("shared_with_community").Bool(),
|
||||
|
@ -88,5 +88,16 @@ func ParseAlbum(data gjson.Result) (types.Album, error) {
|
|||
Comments: data.Get("comment_count").Int(),
|
||||
CreatedAt: createdAt,
|
||||
Media: media,
|
||||
}, nil
|
||||
}
|
||||
|
||||
account := data.Get("account")
|
||||
if account.Raw != "" {
|
||||
album.User = types.User{
|
||||
Id: account.Get("id").Int(),
|
||||
Username: account.Get("username").String(),
|
||||
Avatar: strings.ReplaceAll(account.Get("avatar_url").String(), "https://i.imgur.com", ""),
|
||||
}
|
||||
}
|
||||
|
||||
return album, nil
|
||||
}
|
||||
|
|
|
@ -28,5 +28,12 @@ img {
|
|||
}
|
||||
|
||||
.imageMeta__wrapper {
|
||||
gap: 2rem;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.user {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
}
|
|
@ -10,5 +10,6 @@ type Album struct {
|
|||
CreatedAt string
|
||||
UpdatedAt string
|
||||
Comments int64
|
||||
User User
|
||||
Media []Media
|
||||
}
|
||||
|
|
|
@ -21,6 +21,18 @@
|
|||
<p>{{album.CreatedAt}}</p>
|
||||
|
||||
<div class="imageMeta__wrapper">
|
||||
{{#if album.User}}
|
||||
<div class="user">
|
||||
<a href="/user/{{album.User.Username}}">
|
||||
<img src="{{album.User.Avatar}}" class="pfp" width="36" height="36" loading="lazy" />
|
||||
</a>
|
||||
<a href="/user/{{album.User.Username}}">
|
||||
<p>
|
||||
<b>{{album.User.Username}}</b>
|
||||
</p>
|
||||
</a>
|
||||
</div>
|
||||
{{/if}}
|
||||
<div class="imageMeta">
|
||||
<div class="imageMeta__item">
|
||||
<span class="material-icons-outlined" title="Views">visibility</span>
|
||||
|
@ -31,18 +43,6 @@
|
|||
<p><span class="material-icons-outlined" title="Dislilkes">thumb_down</span> {{album.Downvotes}}</p>
|
||||
{{/if}}
|
||||
</div>
|
||||
<!--<div class="videoDesc__channel">
|
||||
<a href="{{claim.Channel.RelUrl}}">
|
||||
{{#if claim.Channel.Thumbnail}}
|
||||
<img src="{{claim.Channel.Thumbnail}}&w=56&h=56" class="pfp" width="56" height="56" loading="lazy" />
|
||||
{{/if}}
|
||||
</a>
|
||||
<a href="{{claim.Channel.RelUrl}}">
|
||||
<p>
|
||||
<b>{{claim.Channel.Title}}</b>
|
||||
</p>
|
||||
</a>
|
||||
</div>-->
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
|
Loading…
Reference in New Issue