Show avatars in quotes, improve css

This commit is contained in:
Zed 2020-06-10 17:04:48 +02:00
parent 0c9c37e886
commit 754f88a448
4 changed files with 25 additions and 13 deletions

View file

@ -57,6 +57,10 @@
.timeline-container { .timeline-container {
width: 100% !important; width: 100% !important;
.tab-item wide {
flex-grow: 1.4;
}
} }
} }

View file

@ -96,14 +96,17 @@
border-radius: 50%; border-radius: 50%;
} }
.avatar.mini {
margin-right: 5px;
margin-top: -1px;
width: 20px;
height: 20px;
}
.attribution { .attribution {
display: flex; display: flex;
pointer-events: all; pointer-events: all;
margin: 10px 0; margin: 5px 0;
.avatar {
margin-right: 5px;
}
strong { strong {
color: var(--fg_color); color: var(--fg_color);

View file

@ -19,23 +19,24 @@
} }
.tweet-name-row { .tweet-name-row {
padding: 4px 6px; padding: 6px 8px;
margin-top: 1px;
} }
.quote-text { .quote-text {
overflow: hidden; overflow: hidden;
white-space: pre-wrap; white-space: pre-wrap;
word-wrap: break-word; word-wrap: break-word;
padding: 0px 6px 6px 6px; padding: 0px 8px 8px 8px;
} }
.show-thread { .show-thread {
padding: 0px 6px 3px 6px; padding: 0px 8px 6px 8px;
margin-top: -3px; margin-top: -6px;
} }
.replying-to { .replying-to {
padding: 0px 6px; padding: 0px 8px;
margin: unset; margin: unset;
} }
} }

View file

@ -10,6 +10,11 @@ proc getSmallPic(url: string): string =
result &= ":small" result &= ":small"
result = getPicUrl(result) result = getPicUrl(result)
proc renderMiniAvatar(profile: Profile): VNode =
let url = getPicUrl(profile.getUserpic("_mini"))
buildHtml():
img(class="avatar mini", src=url)
proc renderHeader(tweet: Tweet; retweet=""): VNode = proc renderHeader(tweet: Tweet; retweet=""): VNode =
buildHtml(tdiv): buildHtml(tdiv):
if retweet.len > 0: if retweet.len > 0:
@ -189,9 +194,8 @@ proc renderReply(tweet: Tweet): VNode =
a(href=("/" & u)): text "@" & u a(href=("/" & u)): text "@" & u
proc renderAttribution(profile: Profile): VNode = proc renderAttribution(profile: Profile): VNode =
let avatarUrl = getPicUrl(profile.getUserpic("_200x200"))
buildHtml(a(class="attribution", href=("/" & profile.username))): buildHtml(a(class="attribution", href=("/" & profile.username))):
img(class="avatar", width="20", height="20", src=avatarUrl) renderMiniAvatar(profile)
strong: text profile.fullname strong: text profile.fullname
proc renderMediaTags(tags: seq[Profile]): VNode = proc renderMediaTags(tags: seq[Profile]): VNode =
@ -207,7 +211,6 @@ proc renderQuoteMedia(quote: Tweet; prefs: Prefs; path: string): VNode =
buildHtml(tdiv(class="quote-media-container")): buildHtml(tdiv(class="quote-media-container")):
if quote.photos.len > 0: if quote.photos.len > 0:
renderAlbum(quote) renderAlbum(quote)
# genImg(quote.photos[0])
elif quote.video.isSome: elif quote.video.isSome:
renderVideo(quote.video.get(), prefs, path) renderVideo(quote.video.get(), prefs, path)
elif quote.gif.isSome: elif quote.gif.isSome:
@ -227,6 +230,7 @@ proc renderQuote(quote: Tweet; prefs: Prefs; path: string): VNode =
tdiv(class="tweet-name-row"): tdiv(class="tweet-name-row"):
tdiv(class="fullname-and-username"): tdiv(class="fullname-and-username"):
renderMiniAvatar(quote.profile)
linkUser(quote.profile, class="fullname") linkUser(quote.profile, class="fullname")
linkUser(quote.profile, class="username") linkUser(quote.profile, class="username")