Merge pull request #503 from LainLayer/tweet_stats_tweak

Tweet stats tweak
This commit is contained in:
Zed 2022-01-05 13:36:36 +01:00 committed by GitHub
commit d67ff2f330
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 6 deletions

View file

@ -174,7 +174,8 @@
.tweet-stat {
padding-top: 5px;
padding-right: 8px;
min-width: 1em;
margin-right: 0.8em;
}
.show-thread {

View file

@ -45,7 +45,7 @@ proc renderHead*(prefs: Prefs; cfg: Config; titleText=""; desc=""; video="";
let opensearchUrl = getUrlPrefix(cfg) & "/opensearch"
buildHtml(head):
link(rel="stylesheet", type="text/css", href="/css/style.css?v=7")
link(rel="stylesheet", type="text/css", href="/css/style.css?v=8")
link(rel="stylesheet", type="text/css", href="/css/fontello.css?v=2")
if theme.len > 0:

View file

@ -181,12 +181,16 @@ proc renderCard(card: Card; prefs: Prefs; path: string): VNode =
tdiv(class="card-content-container"):
renderCardContent(card)
func formatStat(stat: int): string =
if stat > 0: insertSep($stat, ',')
else: ""
proc renderStats(stats: TweetStats; views: string): VNode =
buildHtml(tdiv(class="tweet-stats")):
span(class="tweet-stat"): icon "comment", insertSep($stats.replies, ',')
span(class="tweet-stat"): icon "retweet", insertSep($stats.retweets, ',')
span(class="tweet-stat"): icon "quote", insertSep($stats.quotes, ',')
span(class="tweet-stat"): icon "heart", insertSep($stats.likes, ',')
span(class="tweet-stat"): icon "comment", formatStat(stats.replies)
span(class="tweet-stat"): icon "retweet", formatStat(stats.retweets)
span(class="tweet-stat"): icon "quote", formatStat(stats.quotes)
span(class="tweet-stat"): icon "heart", formatStat(stats.likes)
if views.len > 0:
span(class="tweet-stat"): icon "play", insertSep(views, ',')