diff options
author | Akshay <[email protected]> | 2024-12-19 16:12:08 +0000 |
---|---|---|
committer | Akshay <[email protected]> | 2024-12-19 16:14:49 +0000 |
commit | f8bef76385f8af54b2f3de24879c1fe04d277c11 (patch) | |
tree | 8764a7d77bcdc541c2b26c03c8e8eb3663ee0ab5 | |
parent | 79b7e7ebcfabc46cbaac0d13b769203b1d3a10e9 (diff) |
add `edited` indicator to comments
-rw-r--r-- | flake.nix | 2 | ||||
-rw-r--r-- | src/mixins/comment.pug | 3 | ||||
-rw-r--r-- | src/mixins/post.pug | 2 | ||||
-rw-r--r-- | src/public/styles.css | 11 | ||||
-rw-r--r-- | src/routes/index.js | 1 | ||||
-rw-r--r-- | src/views/post-search.pug | 2 |
6 files changed, 16 insertions, 5 deletions
@@ -41,7 +41,7 @@ | |||
41 | cp -R ./node_modules/* $out/node_modules | 41 | cp -R ./node_modules/* $out/node_modules |
42 | ls -la $out/node_modules | 42 | ls -la $out/node_modules |
43 | ''; | 43 | ''; |
44 | outputHash = "sha256-+4jTWcQFKd5ZxoViWabHgANIV/fi6oevqK9MiyWeF5c="; | 44 | outputHash = "sha256-iv1DddCTB1yyu21Ev/c4xtLHSvDas9jQAO2Ob9Iah2Q="; |
45 | outputHashAlgo = "sha256"; | 45 | outputHashAlgo = "sha256"; |
46 | outputHashMode = "recursive"; | 46 | outputHashMode = "recursive"; |
47 | }; | 47 | }; |
diff --git a/src/mixins/comment.pug b/src/mixins/comment.pug index f46f293..3eca723 100644 --- a/src/mixins/comment.pug +++ b/src/mixins/comment.pug | |||
@@ -19,6 +19,9 @@ mixin infoContainer(data, next_id, prev_id) | |||
19 | | · | 19 | | · |
20 | | #{timeDifference(Date.now(), data.created * 1000)} | 20 | | #{timeDifference(Date.now(), data.created * 1000)} |
21 | | · | 21 | | · |
22 | if data.edited !== false | ||
23 | | edited #{timeDifference(Date.now(), data.edited * 1000)} ago | ||
24 | | · | ||
22 | a(href=`https://reddit.com${data.permalink}` title="view on reddit").nav-link open ↗ | 25 | a(href=`https://reddit.com${data.permalink}` title="view on reddit").nav-link open ↗ |
23 | 26 | ||
24 | - | 27 | - |
diff --git a/src/mixins/post.pug b/src/mixins/post.pug index b182e0d..74a2b78 100644 --- a/src/mixins/post.pug +++ b/src/mixins/post.pug | |||
@@ -3,7 +3,7 @@ include postUtils | |||
3 | mixin post(p, currentUrl) | 3 | mixin post(p, currentUrl) |
4 | - var from = encodeURIComponent(currentUrl) | 4 | - var from = encodeURIComponent(currentUrl) |
5 | article.post | 5 | article.post |
6 | div(id=`${p.id}`).post-container | 6 | div.post-container |
7 | div.post-text | 7 | div.post-text |
8 | div.title-container | 8 | div.title-container |
9 | a(href=`/comments/${p.id}?from=${from}`) | 9 | a(href=`/comments/${p.id}?from=${from}`) |
diff --git a/src/public/styles.css b/src/public/styles.css index 754eb54..3db6790 100644 --- a/src/public/styles.css +++ b/src/public/styles.css | |||
@@ -25,7 +25,7 @@ | |||
25 | --link-color: #79ffe1; | 25 | --link-color: #79ffe1; |
26 | --link-visited-color: #999; | 26 | --link-visited-color: #999; |
27 | --accent: var(--link-color); | 27 | --accent: var(--link-color); |
28 | --error-text-color: lightcoral; | 28 | --error-text-color: lightcoral; |
29 | } | 29 | } |
30 | } | 30 | } |
31 | 31 | ||
@@ -307,6 +307,13 @@ form { | |||
307 | align-items: center; | 307 | align-items: center; |
308 | } | 308 | } |
309 | 309 | ||
310 | .post-container:target { | ||
311 | outline: 4px solid var(--bg-color-muted); | ||
312 | background: var(--bg-color-muted); | ||
313 | border-radius: 2px; | ||
314 | padding: 5px; | ||
315 | } | ||
316 | |||
310 | .post-text { | 317 | .post-text { |
311 | display: flex; | 318 | display: flex; |
312 | flex-direction: column; | 319 | flex-direction: column; |
@@ -464,7 +471,7 @@ a { | |||
464 | 471 | ||
465 | button { | 472 | button { |
466 | border: 0px solid; | 473 | border: 0px solid; |
467 | border-radius: 4px; | 474 | border-radius: 2px; |
468 | background-color: var(--bg-color-muted); | 475 | background-color: var(--bg-color-muted); |
469 | color: var(--text-color); | 476 | color: var(--text-color); |
470 | padding: 5px; | 477 | padding: 5px; |
diff --git a/src/routes/index.js b/src/routes/index.js index 3e2f04d..34a5e52 100644 --- a/src/routes/index.js +++ b/src/routes/index.js | |||
@@ -159,6 +159,7 @@ router.get("/post-search", authenticateToken, async (req, res) => { | |||
159 | message, | 159 | message, |
160 | user: req.user, | 160 | user: req.user, |
161 | original_query: req.query.q, | 161 | original_query: req.query.q, |
162 | currentUrl: req.url, | ||
162 | }); | 163 | }); |
163 | } | 164 | } |
164 | }); | 165 | }); |
diff --git a/src/views/post-search.pug b/src/views/post-search.pug index 54c1cca..b80f9f6 100644 --- a/src/views/post-search.pug +++ b/src/views/post-search.pug | |||
@@ -20,4 +20,4 @@ html | |||
20 | i #{message} | 20 | i #{message} |
21 | if items | 21 | if items |
22 | each item in items | 22 | each item in items |
23 | +post(item.data) | 23 | +post(item.data, currentUrl) |