Skip to content

Commit

Permalink
added favoriters and retweeters links to tweet-stats
Browse files Browse the repository at this point in the history
  • Loading branch information
PrivacyDevel committed Jun 5, 2023
1 parent 8d9d142 commit 5a6e13d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/sass/tweet/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@
padding-top: 5px;
min-width: 1em;
margin-right: 0.8em;
pointer-events: all;
}

.show-thread {
Expand Down
21 changes: 13 additions & 8 deletions src/views/tweet.nim
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,19 @@ func formatStat(stat: int): string =
if stat > 0: insertSep($stat, ',')
else: ""

proc renderStats(stats: TweetStats; views: string): VNode =
proc renderStats(stats: TweetStats; views: string; tweet: Tweet): VNode =
buildHtml(tdiv(class="tweet-stats")):
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, ',')
a(href=getLink(tweet)):
span(class="tweet-stat"): icon "comment", formatStat(stats.replies)
a(href=getLink(tweet, false) & "/retweeters"):
span(class="tweet-stat"): icon "retweet", formatStat(stats.retweets)
a(href=getLink(tweet)):
span(class="tweet-stat"): icon "quote", formatStat(stats.quotes)
a(href=getLink(tweet, false) & "/favoriters"):
span(class="tweet-stat"): icon "heart", formatStat(stats.likes)
a(href=getLink(tweet)):
if views.len > 0:
span(class="tweet-stat"): icon "play", insertSep(views, ',')

proc renderReply(tweet: Tweet): VNode =
buildHtml(tdiv(class="replying-to")):
Expand Down Expand Up @@ -344,7 +349,7 @@ proc renderTweet*(tweet: Tweet; prefs: Prefs; path: string; class=""; index=0;
renderMediaTags(tweet.mediaTags)

if not prefs.hideTweetStats:
renderStats(tweet.stats, views)
renderStats(tweet.stats, views, tweet)

if showThread:
a(class="show-thread", href=("/i/status/" & $tweet.threadId)):
Expand Down

0 comments on commit 5a6e13d

Please sign in to comment.