1{{ define "fragments/issueComment" }}
2 {{ with .Comment }}
3 <div id="comment-container-{{.CommentId}}">
4 <div class="flex items-center gap-2 mb-2 text-gray-500 text-sm">
5 {{ $owner := index $.DidHandleMap .OwnerDid }}
6 <a href="/{{ $owner }}" class="no-underline hover:underline">{{ $owner }}</a>
7
8 <!-- show user "hats" -->
9 {{ $isIssueAuthor := eq .OwnerDid $.Issue.OwnerDid }}
10 {{ if $isIssueAuthor }}
11 <span class="before:content-['·']"></span>
12 <span class="rounded bg-gray-100 dark:bg-gray-700 text-black dark:text-white font-mono px-2 mx-1/2 inline-flex items-center">
13 author
14 </span>
15 {{ end }}
16
17 <span class="before:content-['·']"></span>
18 <a
19 href="#{{ .CommentId }}"
20 class="text-gray-500 hover:text-gray-500 hover:underline no-underline"
21 id="{{ .CommentId }}">
22 {{ if .Deleted }}
23 deleted {{ .Deleted | timeFmt }}
24 {{ else if .Edited }}
25 edited {{ .Edited | timeFmt }}
26 {{ else }}
27 {{ .Created | timeFmt }}
28 {{ end }}
29 </a>
30
31 {{ $isCommentOwner := and $.LoggedInUser (eq $.LoggedInUser.Did .OwnerDid) }}
32 {{ if and $isCommentOwner (not .Deleted) }}
33 <button
34 class="btn px-2 py-1 text-sm"
35 hx-get="/{{ $.RepoInfo.FullName }}/issues/{{ .Issue }}/comment/{{ .CommentId }}/edit"
36 hx-swap="outerHTML"
37 hx-target="#comment-container-{{.CommentId}}"
38 >
39 {{ i "pencil" "w-4 h-4" }}
40 </button>
41 <button
42 class="btn px-2 py-1 text-sm text-red-500"
43 hx-delete="/{{ $.RepoInfo.FullName }}/issues/{{ .Issue }}/comment/{{ .CommentId }}/"
44 hx-confirm="Are you sure you want to delete your comment?"
45 hx-swap="outerHTML"
46 hx-target="#comment-container-{{.CommentId}}"
47 >
48 {{ i "trash-2" "w-4 h-4" }}
49 </button>
50 {{ end }}
51
52 </div>
53 {{ if not .Deleted }}
54 <div class="prose dark:prose-invert">
55 {{ .Body | markdown }}
56 </div>
57 {{ end }}
58 </div>
59 {{ end }}
60{{ end }}