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