refactor: restructure homepage layout

This commit is contained in:
2025-11-22 18:37:04 -03:00
parent dba8410146
commit 3d9a7e3014
4 changed files with 37 additions and 21 deletions

View File

@@ -1,15 +1,19 @@
# SPDX-License-Identifier: AGPL-3.0-only
import karax/[karaxdsl, vdom]
import profile
import timeline, profile
import ".."/[types]
proc renderHomepage*(users: seq[User]; prefs: Prefs; path: string): VNode =
proc renderHomepage*(users: seq[User]; timeline: VNode; prefs: Prefs; path: string): VNode =
buildHtml(tdiv(class="homepage-container")):
tdiv(class="timeline-users-column"):
for user in users:
renderUser(user, prefs, path)
tdiv(class="timeline"):
timeline
tdiv(class="following-column"):
tdiv(class="profile-cards"):
for user in users:
renderUserCard(user, prefs, path)
tdiv(class="timeline"):
tdiv(id="timeline-container")

View File

@@ -55,7 +55,7 @@ proc renderThread(thread: Tweets; prefs: Prefs; path: string): VNode =
renderTweet(tweet, prefs, path, class=(header & "thread"),
index=i, last=(i == thread.high), showThread=show)
proc renderUser(user: User; prefs: Prefs; path: string): VNode =
proc renderUser*(user: User; prefs: Prefs; path: string): VNode =
let class = if user.sensitive: "timeline-item nsfw" else: "timeline-item"
buildHtml(tdiv(class=class)):
a(class="tweet-link", href=("/" & user.username))