Render "more replies" for the main thread

This commit is contained in:
Zed 2019-08-23 01:20:00 +02:00
parent 9dad8b41de
commit c7339d2126
2 changed files with 21 additions and 6 deletions

View file

@ -345,6 +345,11 @@ video, .video-container img {
display: flex; display: flex;
} }
.video-overlay button {
padding: 5px 8px;
font-size: 16px;
}
.still-image { .still-image {
max-height: 379.5px; max-height: 379.5px;
max-width: 533px; max-width: 533px;
@ -400,6 +405,9 @@ video, .video-container img {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
}
.tweet-stats {
margin-bottom: -3px; margin-bottom: -3px;
} }

View file

@ -4,6 +4,13 @@ import karax/[karaxdsl, vdom]
import ../types import ../types
import tweet, renderutils import tweet, renderutils
proc renderMoreReplies(thread: Thread): VNode =
let num = if thread.more != -1: $thread.more & " " else: ""
let reply = if thread.more == 1: "reply" else: "replies"
buildHtml(tdiv(class="status-el more-replies")):
a(class="more-replies-text", title="Not implemented yet"):
text $num & "more " & reply
proc renderReplyThread(thread: Thread; prefs: Prefs): VNode = proc renderReplyThread(thread: Thread; prefs: Prefs): VNode =
buildHtml(tdiv(class="reply thread thread-line")): buildHtml(tdiv(class="reply thread thread-line")):
for i, tweet in thread.tweets: for i, tweet in thread.tweets:
@ -11,11 +18,7 @@ proc renderReplyThread(thread: Thread; prefs: Prefs): VNode =
renderTweet(tweet, prefs, index=i, last=last) renderTweet(tweet, prefs, index=i, last=last)
if thread.more != 0: if thread.more != 0:
let num = if thread.more != -1: $thread.more & " " else: "" renderMoreReplies(thread)
let reply = if thread.more == 1: "reply" else: "replies"
tdiv(class="status-el more-replies"):
a(class="more-replies-text", title="Not implemented yet"):
text $num & "more " & reply
proc renderConversation*(conversation: Conversation; prefs: Prefs): VNode = proc renderConversation*(conversation: Conversation; prefs: Prefs): VNode =
let hasAfter = conversation.after != nil let hasAfter = conversation.after != nil
@ -33,8 +36,12 @@ proc renderConversation*(conversation: Conversation; prefs: Prefs): VNode =
if hasAfter: if hasAfter:
tdiv(class="after-tweet thread-line"): tdiv(class="after-tweet thread-line"):
let total = conversation.after.tweets.high let total = conversation.after.tweets.high
let more = conversation.after.more
for i, tweet in conversation.after.tweets: for i, tweet in conversation.after.tweets:
renderTweet(tweet, prefs, index=i, total=total) renderTweet(tweet, prefs, index=i, last=(i == total and more == 0))
if more != 0:
renderMoreReplies(conversation.after)
if conversation.replies.len > 0: if conversation.replies.len > 0:
tdiv(class="replies"): tdiv(class="replies"):