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) - Twitter "Cards" (link previews)
- Nitter link previews - Nitter link previews
- Search (+ hashtag search) - Search (+ hashtag search)
- Emoji support - Emoji support (WIP, needs font)
- Twitter polls - Twitter polls
- Server configuration - Server configuration
- Simple account system with feed (excludes retweets) - Simple account system with feed (excludes retweets)

View file

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

View file

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