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