aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshay <[email protected]>2024-12-29 10:49:18 +0000
committerAkshay <[email protected]>2024-12-29 10:49:18 +0000
commiteb2b31f65dec6431b48a0cadd68dbd52c7ab21a4 (patch)
tree93c5da59adbca67693cf8e85806466ae8436e42f
parent6ada78b8b19e7618275c2f9491acc1b5e89cd59a (diff)
highlight sticky comments
-rw-r--r--src/mixins/comment.pug8
-rw-r--r--src/mixins/post.pug2
-rw-r--r--src/public/styles.css13
3 files changed, 20 insertions, 3 deletions
diff --git a/src/mixins/comment.pug b/src/mixins/comment.pug
index 3eca723..ffd4b5a 100644
--- a/src/mixins/comment.pug
+++ b/src/mixins/comment.pug
@@ -1,6 +1,7 @@
1include ../utils 1include ../utils
2 2
3mixin infoContainer(data, next_id, prev_id) 3mixin infoContainer(data, next_id, prev_id)
4 - var hats = (data.is_submitter?['op']:[]).concat(data.distinguished=="moderator"?['mod']:[])
4 div.comment-info-container 5 div.comment-info-container
5 p 6 p
6 | #{fmtnum(data.ups)} ↑ 7 | #{fmtnum(data.ups)} ↑
@@ -12,7 +13,7 @@ mixin infoContainer(data, next_id, prev_id)
12 a(href=`#${prev_id}` title="scroll to previous comment").nav-link prev 13 a(href=`#${prev_id}` title="scroll to previous comment").nav-link prev
13 | &nbsp;·&nbsp; 14 | &nbsp;·&nbsp;
14 span(class=`${data.is_submitter ? 'op' : ''}`) 15 span(class=`${data.is_submitter ? 'op' : ''}`)
15 | u/#{data.author} #{data.is_submitter ? '(op)' : ''} 16 | u/#{data.author} #{hats.length==0?'':`(${hats.join('|')})`}
16 | &nbsp;·&nbsp; 17 | &nbsp;·&nbsp;
17 if data.collapsed_reason_code == "DELETED" || data.author == "[deleted]" 18 if data.collapsed_reason_code == "DELETED" || data.author == "[deleted]"
18 a(href=`https://undelete.pullpush.io${data.permalink}`) search on undelete 19 a(href=`https://undelete.pullpush.io${data.permalink}`) search on undelete
@@ -22,6 +23,9 @@ mixin infoContainer(data, next_id, prev_id)
22 if data.edited !== false 23 if data.edited !== false
23 | edited #{timeDifference(Date.now(), data.edited * 1000)} ago 24 | edited #{timeDifference(Date.now(), data.edited * 1000)} ago
24 | &nbsp;·&nbsp; 25 | &nbsp;·&nbsp;
26 if data.stickied
27 | stickied
28 | &nbsp;·&nbsp;
25 a(href=`https://reddit.com${data.permalink}` title="view on reddit").nav-link open ↗ 29 a(href=`https://reddit.com${data.permalink}` title="view on reddit").nav-link open ↗
26 30
27- 31-
@@ -38,7 +42,7 @@ mixin comment(com, isfirst, parent_id, next_id, prev_id)
38 a(href=`/comments/${parent_id}/comment/${data.id}`) 42 a(href=`/comments/${parent_id}/comment/${data.id}`)
39 | #{data.count} more #{fmttxt(data.count, 'comment')} 43 | #{data.count} more #{fmttxt(data.count, 'comment')}
40 else 44 else
41 div(class=`comment ${isfirst ? 'first' : ''}`) 45 div(class=`comment ${isfirst ? 'first' : ''} ${data.stickied ? 'sticky' : ''}`)
42 details(id=`${data.id}` open="") 46 details(id=`${data.id}` open="")
43 summary.expand-comments 47 summary.expand-comments
44 +infoContainer(data, next_id, prev_id) 48 +infoContainer(data, next_id, prev_id)
diff --git a/src/mixins/post.pug b/src/mixins/post.pug
index 74a2b78..b44ae6d 100644
--- a/src/mixins/post.pug
+++ b/src/mixins/post.pug
@@ -2,7 +2,7 @@ include ../utils
2include postUtils 2include postUtils
3mixin post(p, currentUrl) 3mixin post(p, currentUrl)
4 - var from = encodeURIComponent(currentUrl) 4 - var from = encodeURIComponent(currentUrl)
5 article.post 5 article(class=`post ${p.stickied?"sticky":""}`)
6 div.post-container 6 div.post-container
7 div.post-text 7 div.post-text
8 div.title-container 8 div.title-container
diff --git a/src/public/styles.css b/src/public/styles.css
index 3db6790..c3e06fa 100644
--- a/src/public/styles.css
+++ b/src/public/styles.css
@@ -5,6 +5,7 @@
5 --text-color: black; 5 --text-color: black;
6 --text-color-muted: #999; 6 --text-color-muted: #999;
7 --blockquote-color: green; 7 --blockquote-color: green;
8 --sticky-color: lightgreen;
8 --link-color: #29BC9B; 9 --link-color: #29BC9B;
9 --link-visited-color: #999; 10 --link-visited-color: #999;
10 --accent: var(--link-color); 11 --accent: var(--link-color);
@@ -22,6 +23,7 @@
22 --text-color: white; 23 --text-color: white;
23 --text-color-muted: #999; 24 --text-color-muted: #999;
24 --blockquote-color: lightgreen; 25 --blockquote-color: lightgreen;
26 --sticky-color: #034611;
25 --link-color: #79ffe1; 27 --link-color: #79ffe1;
26 --link-visited-color: #999; 28 --link-visited-color: #999;
27 --accent: var(--link-color); 29 --accent: var(--link-color);
@@ -117,6 +119,10 @@ nav {
117 align-items: stretch; 119 align-items: stretch;
118} 120}
119 121
122.post {
123 margin-bottom: 5px;
124}
125
120.post, .comments-container, .hero, .header, .footer { 126.post, .comments-container, .hero, .header, .footer {
121 padding: 0.3rem; 127 padding: 0.3rem;
122 flex: 1 1 95%; 128 flex: 1 1 95%;
@@ -612,3 +618,10 @@ select {
612 text-indent: 1px; 618 text-indent: 1px;
613 text-overflow: ''; 619 text-overflow: '';
614} 620}
621
622.sticky {
623 background-color: var(--sticky-color);
624 border-radius: 2px;
625 border: 4px solid var(--sticky-color);
626}
627