Monorepo for Tangled
1{{ define "repo/pulls/fragments/pullNewComment" }}
2<div
3 id="pull-comment-card-{{ .RoundNumber }}"
4 class="w-full flex flex-col gap-2">
5 {{ template "user/fragments/picHandleLink" .LoggedInUser.Did }}
6 <form
7 hx-post="/{{ .RepoInfo.FullName }}/pulls/{{ .Pull.PullId }}/round/{{ .RoundNumber }}/comment"
8 hx-swap="none"
9 hx-on::after-request="if(event.detail.successful) this.reset()"
10 hx-disabled-elt="#reply-{{ .RoundNumber }}"
11 class="w-full flex flex-wrap gap-2 group"
12 >
13 <textarea
14 name="body"
15 class="w-full p-2 rounded border"
16 rows=8
17 placeholder="Add to the discussion..."></textarea
18 >
19 {{ template "replyActions" . }}
20 <div id="pull-comment"></div>
21 </form>
22</div>
23{{ end }}
24
25{{ define "replyActions" }}
26 <div class="flex flex-wrap items-stretch justify-end gap-2 text-gray-500 dark:text-gray-400 text-sm w-full">
27 {{ template "cancel" . }}
28 {{ template "reply" . }}
29 </div>
30{{ end }}
31
32{{ define "cancel" }}
33 <button
34 type="button"
35 class="btn text-red-500 dark:text-red-400 flex gap-2 items-center group"
36 hx-get="/{{ .RepoInfo.FullName }}/pulls/{{ .Pull.PullId }}/round/{{ .RoundNumber }}/actions"
37 hx-swap="outerHTML"
38 hx-target="#actions-{{.RoundNumber}}"
39 >
40 {{ i "x" "w-4 h-4" }}
41 <span>cancel</span>
42 </button>
43{{ end }}
44
45{{ define "reply" }}
46 <button
47 type="submit"
48 id="reply-{{ .RoundNumber }}"
49 class="btn-create flex items-center gap-2">
50 {{ i "reply" "w-4 h-4 inline group-[.htmx-request]:hidden" }}
51 {{ i "loader-circle" "w-4 h-4 animate-spin hidden group-[.htmx-request]:inline" }}
52 reply
53 </button>
54{{ end }}
55