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