Thread lines cleanup

This commit is contained in:
Zed 2019-06-25 13:07:12 +02:00
parent 0155607ed3
commit 684489ee21
3 changed files with 9 additions and 10 deletions

View File

@ -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)

View File

@ -117,9 +117,10 @@
</div>
#end proc
#
#proc renderTweet*(tweet: Tweet; class=""): string =
#if class.len > 0:
<div class="${class}">
#proc renderTweet*(tweet: Tweet; class=""; last=false): string =
#var divClass = if last: "thread-last " & class else: class
#if divClass.len > 0:
<div class="${divClass}">
#end if
<div class="status-el">
<div class="status-body">
@ -139,7 +140,7 @@
${renderStats(tweet)}
</div>
</div>
#if class.len > 0:
#if divClass.len > 0:
</div>
#end if
#end proc

View File

@ -113,15 +113,14 @@
#end for
</div>
#end if
#let afterClass = if conversation.after.len > 0: "thread" else: ""
<div class="main-tweet">
#let afterClass = if conversation.after.len > 0: "thread" else: ""
${renderTweet(conversation.tweet, class=afterClass)}
</div>
#if conversation.after.len > 0:
<div class="after-tweet">
#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
</div>
#end if
@ -131,8 +130,7 @@
#for thread in conversation.replies:
<div class="reply thread">
#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
</div>
#end for