1
0
mirror of https://git.sr.ht/~cadence/bibliogram synced 2025-12-14 18:45:06 +00:00
This commit is contained in:
Cadence Ember
2020-06-25 02:58:01 +12:00
parent 865e3b0778
commit a023e09743
12 changed files with 193 additions and 111 deletions

View File

@@ -1,6 +1,8 @@
//- Needs user, selectedTimeline, url, type
include ../includes/timeline_page.pug
include ../includes/next_page_button.pug
+timeline_page(page, pageIndex)
+next_page_button(user, url)
+next_page_button(user, selectedTimeline, url, type)

View File

@@ -1,10 +1,10 @@
mixin next_page_button(user, url)
if user.timeline.hasNextPage()
mixin next_page_button(user, selectedTimeline, url, type)
if selectedTimeline.hasNextPage()
div.next-page-container#next-page-container
-
const nu = new URL(url)
nu.searchParams.set("page", user.timeline.pages.length+1)
a(href=`${nu.search}#page-${user.timeline.pages.length+1}` data-page=(user.timeline.pages.length+1) data-username=(user.data.username))#next-page.next-page Next page
nu.searchParams.set("page", selectedTimeline.pages.length+1)
a(href=`${nu.search}#page-${selectedTimeline.pages.length+1}` data-page=(selectedTimeline.pages.length+1) data-username=(user.data.username) data-type=type)#next-page.next-page Next page
else
div.page-number.no-more-pages
span.number No more posts.

View File

@@ -1,4 +1,4 @@
//- Needs user, followerCountsAvailable, url, constants, settings
//- Needs user, selectedTimeline, type, followerCountsAvailable, url, constants, settings
include includes/timeline_page.pug
include includes/next_page_button.pug
@@ -7,6 +7,9 @@ include includes/feed_link
- const numberFormat = new Intl.NumberFormat().format
mixin selector-button(text, selectorType, urlSuffix)
a(href=(type !== selectorType && `/u/${user.data.username}${urlSuffix}`) class=(type === selectorType && "active")).selector= text
doctype html
html
head
@@ -77,17 +80,23 @@ html
a(href="/") Home
a(href=settingsReferrer) Settings
- const hasPosts = !user.data.is_private && user.timeline.pages.length && user.timeline.pages[0].length
main(class=hasPosts ? "" : "no-posts")#timeline.timeline
if hasPosts
each page, pageIndex in user.timeline.pages
+timeline_page(page, pageIndex)
+next_page_button(user, url)
else
div
div.page-number
span.number
if user.data.is_private
| Profile is private.
else
| No posts.
- const hasPosts = !user.data.is_private && selectedTimeline.pages.length && selectedTimeline.pages[0].length
.timeline-section
.selector-container
+selector-button("Timeline", "timeline", "")
if user.data.has_channel !== false
+selector-button("IGTV", "igtv", "/channel")
main(class=hasPosts ? "" : "no-posts")#timeline.timeline
if hasPosts
each page, pageIndex in selectedTimeline.pages
+timeline_page(page, pageIndex)
+next_page_button(user, selectedTimeline, url, type)
else
div
div.page-number
span.number
if user.data.is_private
| Profile is private.
else
| No posts.