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