eirtube/pug/includes/comment.pug
2024-12-19 18:49:09 -06:00

40 lines
2.1 KiB
Plaintext
Executable File

mixin comment(className, comment, commentOriginalUrl, videoId)
div(class={[className]: true}).comment-base
if comment.authorThumbnails && comment.authorThumbnails.length
.comment-avatar
a(href=comment.authorUrl)
img(loading="lazy" src=comment.authorThumbnails[comment.authorThumbnails.length - 1].url).avatar-img
.comment-contents
a(href=comment.authorUrl class={ "comment-author": true, "is-channel-owner": comment.authorIsChannelOwner })
=comment.author
if comment.verified
.icon.checkmark
if comment.isPinned
.icon.pin
if comment.isSponsor
img(loading="lazy" src=comment.sponsorIconUrl).icon.sponsor
.comment-content
!= videoId ? rewriteVideoDescription(comment.contentHtml, videoId) : comment.contentHtml
.comment-stats
.comment-published
- let publishedText = comment.second__publishedText
if !publishedText
- const publishedTime = comment.published
- publishedText = timeToPastText(publishedTime * 1000)
a(href=commentOriginalUrl.replace("{}", comment.commentId))
!= publishedText
.comment-likes
- let likeText = comment.second__likeText
if !likeText
- const likeCount = comment.likeCount
- likeText = likeCountToText(likeCount)
!= likeText
if comment.creatorHeart
.comment-heart(title=`${comment.creatorHeart.creatorName} gave this a heart`)
img(loading="lazy" src=comment.creatorHeart.creatorThumbnail).comment-heart-avatar
//- .comment-heart-label= comment.creatorHeart.creatorName
if comment.replies && comment.replies.replyCount > 0
.comment-replies
//- TODO:continuation button and such