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