Unify avatar class generation
This commit is contained in:
parent
cc0e4b1668
commit
888e965f41
|
@ -45,7 +45,7 @@ proc renderHead*(prefs: Prefs; cfg: Config; titleText=""; desc=""; video="";
|
||||||
let opensearchUrl = getUrlPrefix(cfg) & "/opensearch"
|
let opensearchUrl = getUrlPrefix(cfg) & "/opensearch"
|
||||||
|
|
||||||
buildHtml(head):
|
buildHtml(head):
|
||||||
link(rel="stylesheet", type="text/css", href="/css/style.css?v=9")
|
link(rel="stylesheet", type="text/css", href="/css/style.css?v=10")
|
||||||
link(rel="stylesheet", type="text/css", href="/css/fontello.css?v=2")
|
link(rel="stylesheet", type="text/css", href="/css/fontello.css?v=2")
|
||||||
|
|
||||||
if theme.len > 0:
|
if theme.len > 0:
|
||||||
|
|
|
@ -88,3 +88,9 @@ proc getTabClass*(query: Query; tab: QueryKind): string =
|
||||||
result = "tab-item"
|
result = "tab-item"
|
||||||
if query.kind == tab:
|
if query.kind == tab:
|
||||||
result &= " active"
|
result &= " active"
|
||||||
|
|
||||||
|
proc getAvatarClass*(prefs: Prefs): string =
|
||||||
|
if prefs.squareAvatars:
|
||||||
|
"avatar"
|
||||||
|
else:
|
||||||
|
"avatar round"
|
||||||
|
|
|
@ -63,7 +63,7 @@ proc renderUser(user: Profile; prefs: Prefs): VNode =
|
||||||
tdiv(class="tweet-body profile-result"):
|
tdiv(class="tweet-body profile-result"):
|
||||||
tdiv(class="tweet-header"):
|
tdiv(class="tweet-header"):
|
||||||
a(class="tweet-avatar", href=("/" & user.username)):
|
a(class="tweet-avatar", href=("/" & user.username)):
|
||||||
genImg(user.getUserPic("_bigger"), class="avatar")
|
genImg(user.getUserPic("_bigger"), class=prefs.getAvatarClass)
|
||||||
|
|
||||||
tdiv(class="tweet-name-row"):
|
tdiv(class="tweet-name-row"):
|
||||||
tdiv(class="fullname-and-username"):
|
tdiv(class="fullname-and-username"):
|
||||||
|
|
|
@ -11,10 +11,10 @@ proc getSmallPic(url: string): string =
|
||||||
result &= ":small"
|
result &= ":small"
|
||||||
result = getPicUrl(result)
|
result = getPicUrl(result)
|
||||||
|
|
||||||
proc renderMiniAvatar(profile: Profile): VNode =
|
proc renderMiniAvatar(profile: Profile; prefs: Prefs): VNode =
|
||||||
let url = getPicUrl(profile.getUserPic("_mini"))
|
let url = getPicUrl(profile.getUserPic("_mini"))
|
||||||
buildHtml():
|
buildHtml():
|
||||||
img(class="avatar mini", src=url)
|
img(class=(prefs.getAvatarClass & " mini"), src=url)
|
||||||
|
|
||||||
proc renderHeader(tweet: Tweet; retweet: string; prefs: Prefs): VNode =
|
proc renderHeader(tweet: Tweet; retweet: string; prefs: Prefs): VNode =
|
||||||
buildHtml(tdiv):
|
buildHtml(tdiv):
|
||||||
|
@ -31,9 +31,7 @@ proc renderHeader(tweet: Tweet; retweet: string; prefs: Prefs): VNode =
|
||||||
var size = "_bigger"
|
var size = "_bigger"
|
||||||
if not prefs.autoplayGifs and tweet.profile.userPic.endsWith("gif"):
|
if not prefs.autoplayGifs and tweet.profile.userPic.endsWith("gif"):
|
||||||
size = "_400x400"
|
size = "_400x400"
|
||||||
|
genImg(tweet.profile.getUserPic(size), class=prefs.getAvatarClass)
|
||||||
let round = if prefs.squareAvatars: "" else: " round"
|
|
||||||
genImg(tweet.profile.getUserPic(size), class=(&"avatar{round}"))
|
|
||||||
|
|
||||||
tdiv(class="tweet-name-row"):
|
tdiv(class="tweet-name-row"):
|
||||||
tdiv(class="fullname-and-username"):
|
tdiv(class="fullname-and-username"):
|
||||||
|
@ -203,9 +201,9 @@ proc renderReply(tweet: Tweet): VNode =
|
||||||
if i > 0: text " "
|
if i > 0: text " "
|
||||||
a(href=("/" & u)): text "@" & u
|
a(href=("/" & u)): text "@" & u
|
||||||
|
|
||||||
proc renderAttribution(profile: Profile): VNode =
|
proc renderAttribution(profile: Profile; prefs: Prefs): VNode =
|
||||||
buildHtml(a(class="attribution", href=("/" & profile.username))):
|
buildHtml(a(class="attribution", href=("/" & profile.username))):
|
||||||
renderMiniAvatar(profile)
|
renderMiniAvatar(profile, prefs)
|
||||||
strong: text profile.fullname
|
strong: text profile.fullname
|
||||||
if profile.verified:
|
if profile.verified:
|
||||||
icon "ok", class="verified-icon", title="Verified account"
|
icon "ok", class="verified-icon", title="Verified account"
|
||||||
|
@ -244,7 +242,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)
|
renderMiniAvatar(quote.profile, prefs)
|
||||||
linkUser(quote.profile, class="fullname")
|
linkUser(quote.profile, class="fullname")
|
||||||
linkUser(quote.profile, class="username")
|
linkUser(quote.profile, class="username")
|
||||||
|
|
||||||
|
@ -323,7 +321,7 @@ proc renderTweet*(tweet: Tweet; prefs: Prefs; path: string; class=""; index=0;
|
||||||
verbatim replaceUrls(tweet.text, prefs) & renderLocation(tweet)
|
verbatim replaceUrls(tweet.text, prefs) & renderLocation(tweet)
|
||||||
|
|
||||||
if tweet.attribution.isSome:
|
if tweet.attribution.isSome:
|
||||||
renderAttribution(tweet.attribution.get())
|
renderAttribution(tweet.attribution.get(), prefs)
|
||||||
|
|
||||||
if tweet.card.isSome:
|
if tweet.card.isSome:
|
||||||
renderCard(tweet.card.get(), prefs, path)
|
renderCard(tweet.card.get(), prefs, path)
|
||||||
|
|
Loading…
Reference in New Issue