Skip to content

Commit 5a6e13d

Browse files
committed
added favoriters and retweeters links to tweet-stats
1 parent 8d9d142 commit 5a6e13d

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

src/sass/tweet/_base.scss

+1
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@
207207
padding-top: 5px;
208208
min-width: 1em;
209209
margin-right: 0.8em;
210+
pointer-events: all;
210211
}
211212

212213
.show-thread {

src/views/tweet.nim

+13-8
Original file line numberDiff line numberDiff line change
@@ -181,14 +181,19 @@ func formatStat(stat: int): string =
181181
if stat > 0: insertSep($stat, ',')
182182
else: ""
183183

184-
proc renderStats(stats: TweetStats; views: string): VNode =
184+
proc renderStats(stats: TweetStats; views: string; tweet: Tweet): VNode =
185185
buildHtml(tdiv(class="tweet-stats")):
186-
span(class="tweet-stat"): icon "comment", formatStat(stats.replies)
187-
span(class="tweet-stat"): icon "retweet", formatStat(stats.retweets)
188-
span(class="tweet-stat"): icon "quote", formatStat(stats.quotes)
189-
span(class="tweet-stat"): icon "heart", formatStat(stats.likes)
190-
if views.len > 0:
191-
span(class="tweet-stat"): icon "play", insertSep(views, ',')
186+
a(href=getLink(tweet)):
187+
span(class="tweet-stat"): icon "comment", formatStat(stats.replies)
188+
a(href=getLink(tweet, false) & "/retweeters"):
189+
span(class="tweet-stat"): icon "retweet", formatStat(stats.retweets)
190+
a(href=getLink(tweet)):
191+
span(class="tweet-stat"): icon "quote", formatStat(stats.quotes)
192+
a(href=getLink(tweet, false) & "/favoriters"):
193+
span(class="tweet-stat"): icon "heart", formatStat(stats.likes)
194+
a(href=getLink(tweet)):
195+
if views.len > 0:
196+
span(class="tweet-stat"): icon "play", insertSep(views, ',')
192197

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

346351
if not prefs.hideTweetStats:
347-
renderStats(tweet.stats, views)
352+
renderStats(tweet.stats, views, tweet)
348353

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

0 commit comments

Comments
 (0)