From c7339d21266cc5536d875158ea92a297c5ab1d75 Mon Sep 17 00:00:00 2001 From: Zed Date: Fri, 23 Aug 2019 01:20:00 +0200 Subject: [PATCH] Render "more replies" for the main thread --- public/css/style.css | 8 ++++++++ src/views/status.nim | 19 +++++++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/public/css/style.css b/public/css/style.css index 5330512..01f2607 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -345,6 +345,11 @@ video, .video-container img { display: flex; } +.video-overlay button { + padding: 5px 8px; + font-size: 16px; +} + .still-image { max-height: 379.5px; max-width: 533px; @@ -400,6 +405,9 @@ video, .video-container img { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; +} + +.tweet-stats { margin-bottom: -3px; } diff --git a/src/views/status.nim b/src/views/status.nim index 8b0b838..91b8293 100644 --- a/src/views/status.nim +++ b/src/views/status.nim @@ -4,6 +4,13 @@ import karax/[karaxdsl, vdom] import ../types 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 = buildHtml(tdiv(class="reply thread thread-line")): for i, tweet in thread.tweets: @@ -11,11 +18,7 @@ proc renderReplyThread(thread: Thread; prefs: Prefs): VNode = renderTweet(tweet, prefs, index=i, last=last) if thread.more != 0: - let num = if thread.more != -1: $thread.more & " " else: "" - 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 + renderMoreReplies(thread) proc renderConversation*(conversation: Conversation; prefs: Prefs): VNode = let hasAfter = conversation.after != nil @@ -33,8 +36,12 @@ proc renderConversation*(conversation: Conversation; prefs: Prefs): VNode = if hasAfter: tdiv(class="after-tweet thread-line"): let total = conversation.after.tweets.high + let more = conversation.after.more 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: tdiv(class="replies"):