Focus replies when "Load more" clicked

This commit is contained in:
Zed 2019-10-22 09:18:18 +02:00
parent f1529077d7
commit c25b780c03
3 changed files with 5 additions and 5 deletions

View file

@ -14,7 +14,7 @@
background-color: $bg_panel;
}
.main-tweet {
.main-tweet, .replies {
padding-top: 50px;
margin-top: -50px;
}

View file

@ -52,10 +52,10 @@ proc renderConversation*(conversation: Conversation; prefs: Prefs; path: string)
renderNewer(Query(), getLink(conversation.tweet))
if conversation.replies.content.len > 0:
tdiv(class="replies"):
tdiv(class="replies", id="r"):
for thread in conversation.replies.content:
if thread == nil: continue
renderReplyThread(thread, prefs, path)
if conversation.replies.hasMore:
renderMore(Query(), conversation.replies.minId)
renderMore(Query(), conversation.replies.minId, focus="#r")

View file

@ -17,9 +17,9 @@ proc renderNewer*(query: Query; path: string): VNode =
a(href=(path & url)):
text "Load newest"
proc renderMore*(query: Query; minId: string): VNode =
proc renderMore*(query: Query; minId: string; focus=""): VNode =
buildHtml(tdiv(class="show-more")):
a(href=(&"?{getQuery(query)}max_position={minId}")):
a(href=(&"?{getQuery(query)}max_position={minId}{focus}")):
text "Load more"
proc renderNoMore(): VNode =