made tweet stats not show number if its equal to 0 and modified css a bit

This commit is contained in:
Mitarashi 2022-01-05 14:10:02 +02:00
parent 9a578b3cbb
commit 6dd64b02fc
2 changed files with 10 additions and 4 deletions

View file

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

View file

@ -181,12 +181,16 @@ proc renderCard(card: Card; prefs: Prefs; path: string): VNode =
tdiv(class="card-content-container"):
renderCardContent(card)
func condNumber(stat: int): string {.inline.} =
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", condNumber(stats.replies)
span(class="tweet-stat"): icon "retweet", condNumber(stats.retweets)
span(class="tweet-stat"): icon "quote" , condNumber(stats.quotes)
span(class="tweet-stat"): icon "heart" , condNumber(stats.likes)
if views.len > 0:
span(class="tweet-stat"): icon "play", insertSep(views, ',')