diff options
| author | Jakob L. Kreuze <zerodaysfordays@sdf.org> | 2026-02-16 12:50:24 -0500 |
|---|---|---|
| committer | Jakob L. Kreuze <zerodaysfordays@sdf.org> | 2026-02-16 12:50:24 -0500 |
| commit | 06bc7adb5e5daa152497efa2fec07334a0126398 (patch) | |
| tree | 4131e7dc1d5b7e26b9308bb7f71563dfd2335fca /jakob | |
| parent | c00ace03d64001c6fb49d7ba7e25d75386eb6ae9 (diff) | |
Fix comment replies
Diffstat (limited to 'jakob')
| -rw-r--r-- | jakob/utils/comments.scm | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/jakob/utils/comments.scm b/jakob/utils/comments.scm index f9228bd..15824b1 100644 --- a/jakob/utils/comments.scm +++ b/jakob/utils/comments.scm @@ -114,17 +114,25 @@ (if (webmention? comment) '() (internal-comment-reactions comment))) + (define (comment-subject comment) + (if (webmention? comment) + #f + (internal-comment-subject comment))) `(article (@ ,@(if (not (webmention? comment)) `((id ,(format #f "comment-~a" (internal-comment-id comment)))) '()) - (class "comment-block")) + ,(if reply? + '(class "comment-block reply") + '(class "comment-block"))) (header (@ (class "comment-meta")) (img (@ (class "comment-avatar") (src ,(comment-photo comment)) (alt "User Icon"))) (div (@ (class "comment-info")) (strong ,(comment-name comment)) - ;; (span (@ (class "subject"))) + ,@(if (comment-subject comment) + `((span (@ (class "subject")) ,(comment-subject comment)(span (@ (class "subject"))))) + '()) (br) ,@(if (and (comment-url comment) (not (string= "" (comment-url comment))) @@ -139,11 +147,20 @@ ,(date->string (comment-publish-time comment) "~B ~e, ~Y at ~H:~M")))) (div (@ (class "comment-body")) ,@(comment-content comment)) - (footer (@ (class "comment-reactions")) - ,@(map (match-lambda - ((emote . count) - `(span (@ (class "reaction")) ,(format #f "~a ~a" emote count)))) - (comment-reactions comment))) + ,@(if (not (webmention? comment)) + `((footer (@ (class "comment-reactions")) + (button (@ (class "reply-button") (hidden #t) + (aria-label "Reply to comment") + (data-target ,(format #f "comment-~a" (internal-comment-id comment))) + (data-reply-to-id ,(internal-comment-id comment))) + "Reply") + ,@(map (match-lambda + ((emote . count) + `(span (@ (class "reaction")) ,(format #f "~a ~a" emote count)))) + (comment-reactions comment)) + (button (@ (class "add-reaction") (hidden #t) + (aria-label "Add reaction")) "+"))) + '()) ,@(if (and (not reply?) (internal-comment? comment) (positive? (length (internal-comment-replies comment)))) |