mirror of
https://git.sr.ht/~cadence/bibliogram
synced 2024-11-22 16:17:29 +00:00
Stick user header to stop
This commit is contained in:
parent
9969dd8c7d
commit
bf3145b684
@ -4,6 +4,11 @@ const {fetchUser, getOrFetchShortcode, userRequestCache, history} = require("../
|
|||||||
const {render, redirect} = require("pinski/plugins")
|
const {render, redirect} = require("pinski/plugins")
|
||||||
const {pugCache} = require("../passthrough")
|
const {pugCache} = require("../passthrough")
|
||||||
|
|
||||||
|
/** @param {import("../../lib/structures/TimelineEntry")} post */
|
||||||
|
function getPageTitle(post) {
|
||||||
|
return (post.getCaptionIntroduction() || `Post from @${post.getBasicOwner().username}`) + " | Bibliogram"
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = [
|
module.exports = [
|
||||||
{
|
{
|
||||||
route: "/", methods: ["GET"], code: async () => {
|
route: "/", methods: ["GET"], code: async () => {
|
||||||
@ -124,7 +129,7 @@ module.exports = [
|
|||||||
statusCode: 200,
|
statusCode: 200,
|
||||||
contentType: "application/json",
|
contentType: "application/json",
|
||||||
content: {
|
content: {
|
||||||
title: post.getCaptionIntroduction(),
|
title: getPageTitle(post),
|
||||||
html: pugCache.get("pug/fragments/post.pug").web({post})
|
html: pugCache.get("pug/fragments/post.pug").web({post})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -165,7 +170,10 @@ module.exports = [
|
|||||||
await post.fetchChildren()
|
await post.fetchChildren()
|
||||||
await post.fetchExtendedOwnerP() // serial await is okay since intermediate fetch result is cached
|
await post.fetchExtendedOwnerP() // serial await is okay since intermediate fetch result is cached
|
||||||
if (post.isVideo()) await post.fetchVideoURL()
|
if (post.isVideo()) await post.fetchVideoURL()
|
||||||
return render(200, "pug/post.pug", {post})
|
return render(200, "pug/post.pug", {
|
||||||
|
title: getPageTitle(post),
|
||||||
|
post
|
||||||
|
})
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
if (error === constants.symbols.NOT_FOUND) {
|
if (error === constants.symbols.NOT_FOUND) {
|
||||||
return render(404, "pug/friendlyerror.pug", {
|
return render(404, "pug/friendlyerror.pug", {
|
||||||
|
@ -16,9 +16,11 @@ mixin post(post, headerWithNavigation)
|
|||||||
img(src="/static/img/arrow-circled.svg" alt="Previous post." style="transform: rotate(180deg)").icon
|
img(src="/static/img/arrow-circled.svg" alt="Previous post." style="transform: rotate(180deg)").icon
|
||||||
button.navigate-posts.next
|
button.navigate-posts.next
|
||||||
img(src="/static/img/arrow-circled.svg" alt="Next post.").icon
|
img(src="/static/img/arrow-circled.svg" alt="Next post.").icon
|
||||||
if post.getCaption()
|
div.relative-box
|
||||||
p.structured-text.description
|
div.scrolling-box
|
||||||
+display_structured(post.getStructuredCaption())
|
if post.getCaption()
|
||||||
|
p.structured-text.description
|
||||||
|
+display_structured(post.getStructuredCaption())
|
||||||
section.images-gallery
|
section.images-gallery
|
||||||
for entry in post.children
|
for entry in post.children
|
||||||
if entry.isVideo()
|
if entry.isVideo()
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
|
//- Needs title, post
|
||||||
|
|
||||||
include includes/post
|
include includes/post
|
||||||
|
|
||||||
doctype html
|
doctype html
|
||||||
html
|
html
|
||||||
head
|
head
|
||||||
title
|
title= title
|
||||||
if post.getCaptionIntroduction()
|
|
||||||
=post.getCaptionIntroduction()
|
|
||||||
else
|
|
||||||
=`Post from @${post.getBasicOwner().username}`
|
|
||||||
=` | Bibliogram`
|
|
||||||
include includes/head
|
include includes/head
|
||||||
script(type="module" src="/static/js/post_overlay.js")
|
script(type="module" src="/static/js/post_overlay.js")
|
||||||
body.post-page
|
body.post-page
|
||||||
|
@ -233,16 +233,16 @@ body
|
|||||||
|
|
||||||
.description-section
|
.description-section
|
||||||
display: grid
|
display: grid
|
||||||
align-items: start
|
align-items: stretch
|
||||||
align-content: normal
|
align-content: stretch
|
||||||
background-color: #eee
|
grid-template-rows: auto 1fr
|
||||||
position: sticky
|
position: sticky
|
||||||
top: 0
|
top: 0
|
||||||
height: 100vh
|
height: 100vh
|
||||||
overflow-y: auto
|
|
||||||
box-sizing: border-box
|
box-sizing: border-box
|
||||||
|
|
||||||
@media screen and (max-width: $layout-a-max)
|
@media screen and (max-width: $layout-a-max)
|
||||||
|
display: contents // this is absolutely disgusting
|
||||||
position: inherit
|
position: inherit
|
||||||
top: inherit
|
top: inherit
|
||||||
height: inherit
|
height: inherit
|
||||||
@ -254,6 +254,8 @@ body
|
|||||||
justify-content: center
|
justify-content: center
|
||||||
background-color: #b3b3b3
|
background-color: #b3b3b3
|
||||||
padding: 10px
|
padding: 10px
|
||||||
|
position: sticky
|
||||||
|
top: 0
|
||||||
|
|
||||||
.navigate-posts
|
.navigate-posts
|
||||||
-webkit-appearance: none
|
-webkit-appearance: none
|
||||||
@ -291,6 +293,21 @@ body
|
|||||||
&:hover
|
&:hover
|
||||||
text-decoration: underline
|
text-decoration: underline
|
||||||
|
|
||||||
|
.relative-box
|
||||||
|
background-color: #eee
|
||||||
|
|
||||||
|
@media screen and (min-width: $layout-b-min)
|
||||||
|
.relative-box
|
||||||
|
position: relative
|
||||||
|
|
||||||
|
.scrolling-box
|
||||||
|
position: absolute
|
||||||
|
top: 0
|
||||||
|
bottom: 0
|
||||||
|
overflow-y: auto
|
||||||
|
display: grid
|
||||||
|
align-items: center
|
||||||
|
|
||||||
.description
|
.description
|
||||||
margin: 12px
|
margin: 12px
|
||||||
white-space: pre-line
|
white-space: pre-line
|
||||||
@ -298,6 +315,8 @@ body
|
|||||||
font-size: 20px
|
font-size: 20px
|
||||||
line-height: 1.4
|
line-height: 1.4
|
||||||
unicode-bidi: plaintext
|
unicode-bidi: plaintext
|
||||||
|
@media screen and (min-width: $layout-b-min)
|
||||||
|
padding-bottom: 20px
|
||||||
|
|
||||||
@media screen and (max-width: $layout-a-max)
|
@media screen and (max-width: $layout-a-max)
|
||||||
font-size: 18px
|
font-size: 18px
|
||||||
@ -312,6 +331,7 @@ body
|
|||||||
|
|
||||||
@media screen and (max-width: $layout-a-max)
|
@media screen and (max-width: $layout-a-max)
|
||||||
flex: 1
|
flex: 1
|
||||||
|
position: relative
|
||||||
|
|
||||||
.sized-image, .sized-video
|
.sized-image, .sized-video
|
||||||
color: #eee
|
color: #eee
|
||||||
@ -524,7 +544,7 @@ body
|
|||||||
bottom: 0
|
bottom: 0
|
||||||
background: rgba(0, 0, 0, 0.7)
|
background: rgba(0, 0, 0, 0.7)
|
||||||
z-index: 10
|
z-index: 10
|
||||||
overflow-y: auto
|
overflow-y: scroll
|
||||||
|
|
||||||
&:not(.loading) > *
|
&:not(.loading) > *
|
||||||
min-height: 100vh
|
min-height: 100vh
|
||||||
|
Loading…
Reference in New Issue
Block a user