This repository has no description
1{{ define "fragments/comment/commentHeader" }}
2 <div
3 class="flex flex-wrap items-center gap-2 text-sm text-gray-500 dark:text-gray-400 "
4 hx-target="next .comment-body"
5 >
6 {{ $handle := resolve .Comment.Did.String }}
7 <a class="text-gray-500 dark:text-gray-400 hover:text-gray-500 dark:hover:text-gray-300" href="/{{ $handle }}">{{ $handle }}</a>
8 {{ template "hats" $ }}
9 <span class="before:content-['·']"></span>
10 {{ template "timestamp" . }}
11 {{ $isCommentOwner := and .LoggedInUser (eq .LoggedInUser.Did .Comment.Did.String) }}
12 {{ if and $isCommentOwner (not .Comment.Deleted) }}
13 {{ if not .Comment.IsLegacy }}
14 {{ template "editCommentBtn" . }}
15 {{ end }}
16 {{ template "deleteCommentBtn" . }}
17 {{ end }}
18 </div>
19{{ end }}
20
21{{ define "hats" }}
22 {{ $isIssueAuthor := eq .Comment.Did .Issue.Did }}
23 {{ if $isIssueAuthor }}
24 (author)
25 {{ end }}
26{{ end }}
27
28{{ define "timestamp" }}
29 <a href="#comment-{{ .Comment.Rkey }}"
30 class="text-gray-500 dark:text-gray-400 hover:text-gray-500 dark:hover:text-gray-400 hover:underline no-underline"
31 id="comment-{{ .Comment.Rkey }}">
32 {{ if .Comment.Deleted }}
33 {{ template "repo/fragments/shortTimeAgo" .Comment.Deleted }}
34 {{ else if .Comment.Edited }}
35 Edited {{ template "repo/fragments/shortTimeAgo" .Comment.Edited }}
36 {{ else }}
37 {{ template "repo/fragments/shortTimeAgo" .Comment.Created }}
38 {{ end }}
39 </a>
40{{ end }}
41
42{{ define "editCommentBtn" }}
43 <a
44 class="text-gray-500 dark:text-gray-400 flex gap-1 items-center group cursor-pointer"
45 hx-get="/comment/edit?aturi={{ .Comment.AtUri }}"
46 >
47 {{ i "pencil" "size-3 inline group-[.htmx-request]:hidden" }}
48 {{ i "loader-circle" "size-3 animate-spin hidden group-[.htmx-request]:inline" }}
49 </a>
50{{ end }}
51
52{{ define "deleteCommentBtn" }}
53 <a
54 class="text-gray-500 dark:text-gray-400 flex gap-1 items-center group cursor-pointer"
55 hx-delete="/comment?aturi={{ .Comment.AtUri }}"
56 hx-confirm="Are you sure you want to delete your comment?"
57 >
58 {{ i "trash-2" "size-3 inline group-[.htmx-request]:hidden" }}
59 {{ i "loader-circle" "size-3 animate-spin hidden group-[.htmx-request]:inline" }}
60 </a>
61{{ end }}