forked from
tangled.org/core
Monorepo for Tangled
1.4 kB
31 lines
1{{ define "repo/pulls/fragments/subscribeButton" }}
2 {{ $subscribed := false }}
3 {{ if .IsSubscribed }}{{ $subscribed = .IsSubscribed }}{{ end }}
4 <div id="pull-subscribe-btn">
5 {{ if $subscribed }}
6 <form
7 hx-post="/{{ .RepoInfo.FullName }}/pulls/{{ .PullId }}/subscribe"
8 hx-target="#pull-subscribe-btn"
9 hx-swap="outerHTML">
10 <input type="hidden" name="subscribe" value="false">
11 <button type="submit" class="flex items-center gap-1.5 text-sm text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white transition-colors group">
12 {{ i "bell" "w-4 h-4" }}
13 <span>Subscribed</span>
14 {{ i "loader-circle" "w-3 h-3 animate-spin hidden group-[.htmx-request]:inline" }}
15 </button>
16 </form>
17 {{ else }}
18 <form
19 hx-post="/{{ .RepoInfo.FullName }}/pulls/{{ .PullId }}/subscribe"
20 hx-target="#pull-subscribe-btn"
21 hx-swap="outerHTML">
22 <input type="hidden" name="subscribe" value="true">
23 <button type="submit" class="flex items-center gap-1.5 text-sm text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 transition-colors group">
24 {{ i "bell-off" "w-4 h-4" }}
25 <span>Subscribe</span>
26 {{ i "loader-circle" "w-3 h-3 animate-spin hidden group-[.htmx-request]:inline" }}
27 </button>
28 </form>
29 {{ end }}
30 </div>
31{{ end }}