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