From 684489ee2197496bd2e458c3fed8b7ce53d758d8 Mon Sep 17 00:00:00 2001 From: Zed Date: Tue, 25 Jun 2019 13:07:12 +0200 Subject: [PATCH] Thread lines cleanup --- README.md | 2 +- src/views/tweet.nimf | 9 +++++---- src/views/user.nimf | 8 +++----- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 5565cfc..79db3d8 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ is on implementing missing features. - Twitter "Cards" (link previews) - Nitter link previews - Search (+ hashtag search) -- Emoji support +- Emoji support (WIP, needs font) - Twitter polls - Server configuration - Simple account system with feed (excludes retweets) diff --git a/src/views/tweet.nimf b/src/views/tweet.nimf index 362adb5..a060bea 100644 --- a/src/views/tweet.nimf +++ b/src/views/tweet.nimf @@ -117,9 +117,10 @@ #end proc # -#proc renderTweet*(tweet: Tweet; class=""): string = -#if class.len > 0: -
+#proc renderTweet*(tweet: Tweet; class=""; last=false): string = +#var divClass = if last: "thread-last " & class else: class +#if divClass.len > 0: +
#end if
@@ -139,7 +140,7 @@ ${renderStats(tweet)}
-#if class.len > 0: +#if divClass.len > 0:
#end if #end proc diff --git a/src/views/user.nimf b/src/views/user.nimf index 6be21c5..a85c7cb 100644 --- a/src/views/user.nimf +++ b/src/views/user.nimf @@ -113,15 +113,14 @@ #end for
#end if - #let afterClass = if conversation.after.len > 0: "thread" else: ""
+ #let afterClass = if conversation.after.len > 0: "thread" else: "" ${renderTweet(conversation.tweet, class=afterClass)}
#if conversation.after.len > 0:
#for i, tweet in conversation.after: - #let class = if i == conversation.after.high: "thread-last" else: "" - ${renderTweet(tweet, class=class)} + ${renderTweet(tweet, last=(i == conversation.after.high))} #end for
#end if @@ -131,8 +130,7 @@ #for thread in conversation.replies:
#for i, tweet in thread: - #let class = if i == thread.high: "thread-last" else: "" - ${renderTweet(tweet, class=class)} + ${renderTweet(tweet, last=(i == thread.high))} #end for
#end for