Fix missing "Show thread" links
This commit is contained in:
		
							parent
							
								
									10bcf99205
								
							
						
					
					
						commit
						19659de410
					
				| 
						 | 
				
			
			@ -118,6 +118,7 @@
 | 
			
		|||
 | 
			
		||||
.show-thread {
 | 
			
		||||
    display: block;
 | 
			
		||||
    pointer-events: all;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.unavailable-box {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -35,8 +35,9 @@ proc renderNoneFound(): VNode =
 | 
			
		|||
proc renderThread(thread: seq[Tweet]; prefs: Prefs; path: string): VNode =
 | 
			
		||||
  buildHtml(tdiv(class="thread-line")):
 | 
			
		||||
    for i, threadTweet in thread.sortedByIt(it.time):
 | 
			
		||||
      let show = i == thread.len and thread[0].id != threadTweet.threadId
 | 
			
		||||
      renderTweet(threadTweet, prefs, path, class="thread",
 | 
			
		||||
                  index=i, total=thread.high)
 | 
			
		||||
                  index=i, total=thread.high, showThread=show)
 | 
			
		||||
 | 
			
		||||
proc threadFilter(it: Tweet; tweetThread: string): bool =
 | 
			
		||||
  it.retweet.isNone and it.reply.len == 0 and it.threadId == tweetThread
 | 
			
		||||
| 
						 | 
				
			
			@ -83,7 +84,7 @@ proc renderTimelineTweets*(results: Result[Tweet]; prefs: Prefs; path: string):
 | 
			
		|||
        if tweet.threadId in threads: continue
 | 
			
		||||
        let thread = results.content.filterIt(threadFilter(it, tweet.threadId))
 | 
			
		||||
        if thread.len < 2:
 | 
			
		||||
          renderTweet(tweet, prefs, path)
 | 
			
		||||
          renderTweet(tweet, prefs, path, showThread=tweet.hasThread)
 | 
			
		||||
        else:
 | 
			
		||||
          renderThread(thread, prefs, path)
 | 
			
		||||
          threads &= tweet.threadId
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -222,7 +222,7 @@ proc renderQuote(quote: Quote; prefs: Prefs): VNode =
 | 
			
		|||
        text "Show this thread"
 | 
			
		||||
 | 
			
		||||
proc renderTweet*(tweet: Tweet; prefs: Prefs; path: string; class="";
 | 
			
		||||
                  index=0; total=(-1); last=false): VNode =
 | 
			
		||||
                  index=0; total=(-1); last=false; showThread=false): VNode =
 | 
			
		||||
  var divClass = class
 | 
			
		||||
  if index == total or last:
 | 
			
		||||
    divClass = "thread-last " & class
 | 
			
		||||
| 
						 | 
				
			
			@ -265,6 +265,6 @@ proc renderTweet*(tweet: Tweet; prefs: Prefs; path: string; class="";
 | 
			
		|||
      if not prefs.hideTweetStats:
 | 
			
		||||
        renderStats(tweet.stats, views)
 | 
			
		||||
 | 
			
		||||
      if tweet.hasThread and "timeline" in class:
 | 
			
		||||
      if showThread:
 | 
			
		||||
        a(class="show-thread", href=getLink(tweet)):
 | 
			
		||||
          text "Show this thread"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue