mirror of
https://git.sr.ht/~cadence/bibliogram
synced 2024-11-22 16:17:29 +00:00
Add date to posts
This commit is contained in:
parent
00920d8f6d
commit
ba5a5a7653
@ -27,6 +27,7 @@ class TimelineEntry extends TimelineBaseMethods {
|
|||||||
this.ownerPfpCacheP = null
|
this.ownerPfpCacheP = null
|
||||||
/** @type {import("./TimelineChild")[]} Not available until fetchChildren is called */
|
/** @type {import("./TimelineChild")[]} Not available until fetchChildren is called */
|
||||||
this.children = null
|
this.children = null
|
||||||
|
this.date = null
|
||||||
}
|
}
|
||||||
|
|
||||||
async update() {
|
async update() {
|
||||||
@ -80,6 +81,21 @@ class TimelineEntry extends TimelineBaseMethods {
|
|||||||
* All mutations should act exactly once and have no effect on already mutated data.
|
* All mutations should act exactly once and have no effect on already mutated data.
|
||||||
*/
|
*/
|
||||||
fixData() {
|
fixData() {
|
||||||
|
this.date = new Date(this.data.taken_at_timestamp*1000)
|
||||||
|
}
|
||||||
|
|
||||||
|
getDisplayDate() {
|
||||||
|
function pad(number) {
|
||||||
|
return String(number).padStart(2, "0")
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
`${this.date.getUTCFullYear()}`
|
||||||
|
+ `-${pad(this.date.getUTCMonth()+1)}`
|
||||||
|
+ `-${pad(this.date.getUTCDay()+1)}`
|
||||||
|
+ ` ${pad(this.date.getUTCHours())}`
|
||||||
|
+ `:${pad(this.date.getUTCMinutes())}`
|
||||||
|
+ ` UTC`
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
getCaption() {
|
getCaption() {
|
||||||
|
@ -105,7 +105,6 @@
|
|||||||
* @property {boolean} [has_ranked_comments]
|
* @property {boolean} [has_ranked_comments]
|
||||||
* @property {boolean} [comments_disabled]
|
* @property {boolean} [comments_disabled]
|
||||||
* @property {boolean} [commenting_disabled_for_viewer]
|
* @property {boolean} [commenting_disabled_for_viewer]
|
||||||
* @property {number} [taken_at_timestamp]
|
|
||||||
* @property {boolean} [is_ad]
|
* @property {boolean} [is_ad]
|
||||||
* @property {any} [edge_web_media_to_related_media] todo: discover
|
* @property {any} [edge_web_media_to_related_media] todo: discover
|
||||||
* Image
|
* Image
|
||||||
|
@ -25,15 +25,18 @@ mixin post(post, headerWithNavigation)
|
|||||||
|
|
||||||
div.relative-box
|
div.relative-box
|
||||||
div.scrolling-box
|
div.scrolling-box
|
||||||
if post.getCaption()
|
div
|
||||||
p.structured-text.description
|
if post.getCaption()
|
||||||
+display_structured(post.getStructuredCaption())
|
p.structured-text.description
|
||||||
|
+display_structured(post.getStructuredCaption())
|
||||||
|
|
||||||
if willDisplayAltInDescription
|
footer
|
||||||
each child in post.children
|
if willDisplayAltInDescription
|
||||||
- let caption = child.data.accessibility_caption
|
- let caption = post.children[0].data.accessibility_caption
|
||||||
if caption
|
if caption
|
||||||
p.description= caption
|
p.description= caption
|
||||||
|
p.description
|
||||||
|
span Posted on #[time(datetime=post.date.toISOString() data-local-date)= post.getDisplayDate()].
|
||||||
|
|
||||||
section.images-gallery
|
section.images-gallery
|
||||||
for entry in post.children
|
for entry in post.children
|
||||||
|
@ -362,8 +362,7 @@ body
|
|||||||
background-color: map-get($theme, "background-post-caption")
|
background-color: map-get($theme, "background-post-caption")
|
||||||
color: map-get($theme, "foreground-primary")
|
color: map-get($theme, "foreground-primary")
|
||||||
|
|
||||||
@media screen and (min-width: $layout-b-min)
|
@media screen and (min-width: $layout-b-min)
|
||||||
.relative-box
|
|
||||||
position: relative
|
position: relative
|
||||||
box-shadow: map-get($theme, "shadow-down-inset")
|
box-shadow: map-get($theme, "shadow-down-inset")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user