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