Display "more replies"

This commit is contained in:
Zed
2019-07-01 03:13:12 +02:00
parent 160c28eda3
commit a901e50df5
6 changed files with 77 additions and 33 deletions

View File

@@ -51,7 +51,7 @@
#end proc
#
#proc renderTimeline*(timeline: Timeline; profile: Profile; beginning: bool): string =
#var retweets: Tweets
#var retweets: seq[Tweet]
<div id="tweets">
#if not beginning:
<div class="show-more status-el">
@@ -104,21 +104,21 @@
#proc renderConversation*(conversation: Conversation): string =
<div class="conversation" id="tweets">
<div class="main-thread">
#if conversation.before.len > 0:
#if conversation.before.tweets.len > 0:
<div class="before-tweet thread-line">
#for tweet in conversation.before:
#for tweet in conversation.before.tweets:
${renderTweet(tweet)}
#end for
</div>
#end if
<div class="main-tweet">
#let afterClass = if conversation.after.len > 0: "thread thread-line" else: ""
#let afterClass = if conversation.after.tweets.len > 0: "thread thread-line" else: ""
${renderTweet(conversation.tweet, class=afterClass)}
</div>
#if conversation.after.len > 0:
#if conversation.after.tweets.len > 0:
<div class="after-tweet thread-line">
#for i, tweet in conversation.after:
${renderTweet(tweet, last=(i == conversation.after.high))}
#for i, tweet in conversation.after.tweets:
${renderTweet(tweet, last=(i == conversation.after.tweets.high))}
#end for
</div>
#end if
@@ -127,9 +127,15 @@
<div class="replies">
#for thread in conversation.replies:
<div class="reply thread thread-line">
#for i, tweet in thread:
${renderTweet(tweet, last=(i == thread.high))}
#for i, tweet in thread.tweets:
${renderTweet(tweet, last=(i == thread.tweets.high and thread.more == 0))}
#end for
#if thread.more != 0:
#let num = if thread.more != -1: $thread.more & " " else: ""
<div class="status-el more-replies">
<a class="more-replies-text" title="Not implemented yet">${num}more replies</a>
</div>
#end if
</div>
#end for
</div>