This repository has no description
1{{ define "fragments/starBtn" }}
2 {{/* NOTE: this fragment is always replaced with hx-swap-oob */}}
3 <div
4 id="starBtn"
5 class="btn-group w-full"
6 data-star-subject-at="{{ .SubjectAt }}"
7 {{ if .HxSwapOob }}hx-swap-oob='outerHTML:#starBtn[data-star-subject-at="{{ .SubjectAt }}"]'{{ end }}
8 >
9 <button
10 class="btn-group-item active flex-1 gap-1 group"
11 {{ if .IsStarred }}
12 hx-delete="/star?subject={{ .SubjectAt }}&countHint={{ .StarCount }}&repoName={{ .RepoName }}"
13 {{ else }}
14 hx-post="/star?subject={{ .SubjectAt }}&countHint={{ .StarCount }}&repoName={{ .RepoName }}"
15 {{ end }}
16 hx-trigger="click"
17 hx-disabled-elt="this"
18 >
19 {{ if .IsStarred }}
20 {{ i "star" "w-4 h-4 shrink-0 fill-current inline group-[.htmx-request]:hidden" }}
21 {{ else }}
22 {{ i "star" "w-4 h-4 shrink-0 inline group-[.htmx-request]:hidden" }}
23 {{ end }}
24 {{ i "loader-circle" "w-4 h-4 shrink-0 animate-spin hidden group-[.htmx-request]:inline" }}
25 <span class="group-[.htmx-request]:hidden">{{ if .IsStarred }}unstar{{ else }}star{{ end }}</span>
26 </button>
27 {{ if .RepoName }}
28 {{ $did := .SubjectAt.Authority | string }}
29 <a
30 href="/{{ resolve $did }}/{{ .RepoName }}/stars"
31 class="btn-group-item"
32 title="Starred by"
33 >
34 {{ scaleFmt .StarCount }}
35 </a>
36 {{ else }}
37 <span class="btn-group-item cursor-default">
38 {{ scaleFmt .StarCount }}
39 </span>
40 {{ end }}
41 </div>
42{{ end }}