feat: added homepage feed showing followed accounts

This commit is contained in:
2025-11-21 23:03:58 -03:00
parent 62a4347b96
commit 73360e6972
7 changed files with 114 additions and 5 deletions

15
src/views/homepage.nim Normal file
View File

@@ -0,0 +1,15 @@
# SPDX-License-Identifier: AGPL-3.0-only
import karax/[karaxdsl, vdom]
import profile
import ".."/[types]
proc renderHomepage*(users: seq[User]; prefs: Prefs; path: string): VNode =
buildHtml(tdiv(class="homepage-container")):
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

@@ -50,6 +50,21 @@ proc renderTweetSearch*(results: Timeline; prefs: Prefs; path: string;
renderTimelineTweets(results, prefs, path, pinned)
proc renderHomepageTabs*(query: Query): VNode =
buildHtml(ul(class="tab")):
li(class=if query.kind == tweets: "tab-item active" else: "tab-item"):
a(href="/?f=tweets"): text "Tweets"
li(class=if query.kind == replies: "tab-item active" else: "tab-item"):
a(href="/?f=replies"): text "Tweets & Replies"
proc renderHomepageTimeline*(results: Timeline; prefs: Prefs; path: string): VNode =
let query = results.query
buildHtml(tdiv(class="timeline-container")):
renderHomepageTabs(query)
renderTimelineTweets(results, prefs, path)
proc renderUserSearch*(results: Result[User]; prefs: Prefs; path: string): VNode =
buildHtml(tdiv(class="timeline-container")):
renderSearchTabs(results.query)