mirror of
https://git.sr.ht/~cadence/bibliogram
synced 2025-12-16 19:18:49 +00:00
First release
This commit is contained in:
5
src/site/pug/includes/image.pug
Normal file
5
src/site/pug/includes/image.pug
Normal file
@@ -0,0 +1,5 @@
|
||||
mixin image(url)
|
||||
-
|
||||
let params = new URLSearchParams()
|
||||
params.set("url", url)
|
||||
img(src="/imageproxy?"+params.toString())&attributes(attributes)
|
||||
15
src/site/pug/includes/timeline_page.pug
Normal file
15
src/site/pug/includes/timeline_page.pug
Normal file
@@ -0,0 +1,15 @@
|
||||
//- Needs page, pageIndex
|
||||
|
||||
include image.pug
|
||||
|
||||
mixin timeline_page(page, pageIndex)
|
||||
- const pageNumber = pageIndex + 1
|
||||
if pageNumber > 1
|
||||
.page-number(id=`page-${pageNumber}`)
|
||||
span.number Page #{pageNumber}
|
||||
|
||||
.timeline-inner
|
||||
- const suggestedSize = 300
|
||||
each image in page
|
||||
- const thumbnail = image.getSuggestedThumbnail(suggestedSize) //- use this as the src in case there are problems with srcset
|
||||
+image(thumbnail.src)(alt=image.getAlt() width=thumbnail.config_width height=thumbnail.config_height srcset=image.getSrcset() sizes=`${suggestedSize}px`).image
|
||||
49
src/site/pug/user.pug
Normal file
49
src/site/pug/user.pug
Normal file
@@ -0,0 +1,49 @@
|
||||
include includes/timeline_page.pug
|
||||
|
||||
- const numberFormat = new Intl.NumberFormat().format
|
||||
|
||||
doctype html
|
||||
html
|
||||
head
|
||||
meta(charset="utf-8")
|
||||
meta(name="viewport" content="width=device-width, initial-scale=1")
|
||||
title
|
||||
= `${user.data.full_name} (@${user.data.username}) | Bibliogram`
|
||||
link(rel="stylesheet" type="text/css" href="/static/css/main.css")
|
||||
body
|
||||
.main-divider
|
||||
header.profile-overview
|
||||
.profile-sticky
|
||||
+image(user.data.profile_pic_url)(width="150px" height="150px").pfp
|
||||
//-
|
||||
Instagram only uses the above URL, but an HD version is also available:
|
||||
+image(user.data.profile_pic_url_hd)
|
||||
h1.full-name= user.data.full_name
|
||||
h2.username= `@${user.data.username}`
|
||||
p.bio= user.data.biography
|
||||
div.profile-counter
|
||||
span(data-numberformat=user.posts).count #{numberFormat(user.posts)}
|
||||
|
|
||||
| posts
|
||||
div.profile-counter
|
||||
span(data-numberformat=user.following).count #{numberFormat(user.following)}
|
||||
|
|
||||
| following
|
||||
div.profile-counter
|
||||
span(data-numberformat=user.followedBy).count #{numberFormat(user.followedBy)}
|
||||
|
|
||||
| followed by
|
||||
|
||||
main.timeline
|
||||
each page, pageIndex in user.timeline.pages
|
||||
+timeline_page(page, pageIndex)
|
||||
|
||||
if user.timeline.hasNextPage()
|
||||
div.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-cursor=user.timeline.page_info.end_cursor)#next-page.next-page Next page
|
||||
else
|
||||
div.page-number.no-more-pages
|
||||
span.number No more posts.
|
||||
Reference in New Issue
Block a user