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