this repo has no description
1{{ define "user/fragments/editBio" }}
2 <form
3 hx-post="/profile/bio"
4 class="flex flex-col gap-4 my-2 max-w-full"
5 hx-disabled-elt="#save-btn,#cancel-btn"
6 hx-swap="none"
7 hx-indicator="#spinner">
8 <div class="flex flex-col gap-1">
9 {{ $description := "" }}
10 {{ if and .Profile .Profile.Description }}
11 {{ $description = .Profile.Description }}
12 {{ end }}
13 <label class="m-0 p-0" for="description">bio</label>
14 <textarea
15 type="text"
16 class="py-1 px-1 w-full"
17 name="description"
18 rows="3"
19 placeholder="write a bio">
20{{ $description }}</textarea
21 >
22 </div>
23
24 <div class="flex flex-col gap-1">
25 <label class="m-0 p-0" for="location">location</label>
26 <div class="flex items-center gap-2 w-full">
27 {{ $location := "" }}
28 {{ if and .Profile .Profile.Location }}
29 {{ $location = .Profile.Location }}
30 {{ end }}
31 <span class="flex-shrink-0">{{ i "map-pin" "size-4" }}</span>
32 <input
33 type="text"
34 class="py-1 px-1 w-full"
35 name="location"
36 value="{{ $location }}" />
37 </div>
38 </div>
39
40 <div class="flex flex-col gap-1">
41 <label class="m-0 p-0">social links</label>
42 <div class="flex items-center gap-2 py-1">
43 {{ $includeBsky := false }}
44 {{ if and .Profile .Profile.IncludeBluesky }}
45 {{ $includeBsky = true }}
46 {{ end }}
47 <input
48 type="checkbox"
49 id="includeBluesky"
50 name="includeBluesky"
51 value="on"
52 {{ if $includeBsky }}checked{{ end }} />
53 <label for="includeBluesky" class="my-0 py-0 normal-case font-normal">
54 Link to Bluesky account
55 </label>
56 </div>
57
58 {{ $profile := .Profile }}
59 {{ range $idx, $s := (sequence 5) }}
60 {{ $link := "" }}
61 {{ if and $profile $profile.Links }}
62 {{ if lt $idx (len $profile.Links) }}
63 {{ $link = index $profile.Links $idx }}
64 {{ end }}
65 {{ end }}
66
67
68 <div class="flex items-center gap-2 w-full">
69 <span class="flex-shrink-0">{{ i "link" "size-4" }}</span>
70 <input
71 type="text"
72 class="py-1 px-1 w-full"
73 name="link{{ $idx }}"
74 value="{{ $link }}"
75 placeholder="social link {{ add $idx 1 }}" />
76 </div>
77 {{ end }}
78 </div>
79
80 <div class="flex flex-col gap-1">
81 <label class="m-0 p-0">vanity stats</label>
82 {{ range $idx, $s := (sequence 2) }}
83 {{ $stat := "" }}
84 {{ if and $profile $profile.Stats }}
85 {{ if lt $idx (len $profile.Stats) }}
86 {{ $s := index $profile.Stats $idx }}
87 {{ $stat = $s.Kind }}
88 {{ end }}
89 {{ end }}
90
91 {{ block "stat" (list $idx $stat) }}{{ end }}
92 {{ end }}
93 </div>
94
95 <div class="flex items-center gap-2 justify-between">
96 <button
97 id="save-btn"
98 type="submit"
99 class="btn p-1 w-full flex items-center gap-2 no-underline text-sm">
100 {{ i "check" "size-4" }} save
101 <span id="spinner" class="group">
102 {{ i "loader-circle" "w-4 h-4 animate-spin hidden group-[.htmx-request]:inline" }}
103 </span>
104 </button>
105 <a
106 href="/{{ .LoggedInUser.Did }}"
107 class="w-full no-underline hover:no-underline">
108 <button
109 id="cancel-btn"
110 type="button"
111 class="btn p-1 w-full flex items-center gap-2 no-underline text-sm">
112 {{ i "x" "size-4" }} cancel
113 </button>
114 </a>
115 </div>
116 </form>
117{{ end }}
118
119{{ define "stat" }}
120 {{ $id := index . 0 }}
121 {{ $stat := index . 1 }}
122 <select
123 class="stat-group w-full p-1 border border-gray-200 bg-white dark:bg-gray-800 dark:text-white dark:border-gray-700 text-sm"
124 id="stat{{ $id }}"
125 name="stat{{ $id }}">
126 <option value="">choose stat</option>
127 {{ $stats := assoc
128 "merged-pull-request-count" "Merged PR Count"
129 "closed-pull-request-count" "Closed PR Count"
130 "open-pull-request-count" "Open PR Count"
131 "open-issue-count" "Open Issue Count"
132 "closed-issue-count" "Closed Issue Count"
133 "repository-count" "Repository Count"
134 }}
135 {{ range $s := $stats }}
136 {{ $value := index $s 0 }}
137 {{ $label := index $s 1 }}
138 <option value="{{ $value }}" {{ if eq $stat $value }}selected{{ end }}>
139 {{ $label }}
140 </option>
141 {{ end }}
142 </select>
143{{ end }}