forked from tangled.org/core
this repo has no description
1{{ define "title" }}settings{{ end }} 2 3{{ define "content" }} 4 <div class="p-6"> 5 <p class="text-xl font-bold">Settings</p> 6 </div> 7 <div class="flex flex-col"> 8 {{ block "profile" . }} {{ end }} 9 {{ block "keys" . }} {{ end }} 10 {{ block "knots" . }} {{ end }} 11 {{ block "emails" . }} {{ end }} 12 </div> 13{{ end }} 14 15{{ define "profile" }} 16<h2 class="text-sm font-bold py-2 px-6 uppercase">profile</h2> 17<section class="rounded bg-white drop-shadow-sm px-6 py-4 mb-6 w-full lg:w-fit"> 18 <dl class="grid grid-cols-[auto_1fr] gap-x-4"> 19 {{ if .LoggedInUser.Handle }} 20 <dt class="font-bold">handle</dt> 21 <dd>@{{ .LoggedInUser.Handle }}</dd> 22 {{ end }} 23 <dt class="font-bold">did</dt> 24 <dd>{{ .LoggedInUser.Did }}</dd> 25 <dt class="font-bold">pds</dt> 26 <dd>{{ .LoggedInUser.Pds }}</dd> 27 </dl> 28</section> 29{{ end }} 30 31{{ define "keys" }} 32<h2 class="text-sm font-bold py-2 px-6 uppercase">ssh keys</h2> 33<section class="rounded bg-white drop-shadow-sm px-6 py-4 mb-6 w-full lg:w-fit"> 34 <p class="mb-8">SSH public keys added here will be broadcasted to knots that you are a member of, <br> allowing you to push to repositories there.</p> 35 <div id="key-list" class="flex flex-col gap-6 mb-8"> 36 {{ range $index, $key := .PubKeys }} 37 <div class="flex justify-between items-center gap-4"> 38 <div> 39 <div class="inline-flex items-center gap-4"> 40 <i class="w-3 h-3" data-lucide="key"></i> 41 <p class="font-bold">{{ .Name }}</p> 42 <p class="text-sm text-gray-500">added {{ .Created | timeFmt }}</p> 43 </div> 44 <code class="block break-all text-sm text-gray-500">{{ .Key }}</code> 45 </div> 46 <button 47 class="btn text-red-500 hover:text-red-700" 48 title="Delete key" 49 hx-delete="/settings/keys?name={{urlquery .Name}}&rkey={{urlquery .Rkey}}&key={{urlquery .Key}}" 50 hx-confirm="Are you sure you wish to delete the key '{{ .Name }}'?"> 51 <i class="w-5 h-5" data-lucide="trash-2"></i> 52 </button> 53 </div> 54 {{ end }} 55 </div> 56 <form 57 hx-put="/settings/keys" 58 hx-swap="none" 59 class="max-w-2xl mb-8 space-y-4" 60 > 61 <input 62 type="text" 63 id="name" 64 name="name" 65 placeholder="key name" 66 required 67 class="w-full"/> 68 69 <input 70 id="key" 71 name="key" 72 placeholder="ssh-rsa AAAAAA..." 73 required 74 class="w-full"/> 75 76 <button class="btn" type="submit">add key</button> 77 78 <div id="settings-keys" class="error"></div> 79 </form> 80</section> 81{{ end }} 82 83{{ define "emails" }} 84<h2 class="text-sm font-bold py-2 px-6 uppercase">email addresses</h2> 85<section class="rounded bg-white drop-shadow-sm px-6 py-4 mb-6 w-full lg:w-fit"> 86<p class="mb-8">Commits authored using emails listed here will be associated with your Tangled profile.</p> 87 <div id="email-list" class="flex flex-col gap-6 mb-8"> 88 {{ range $index, $email := .Emails }} 89 <div class="flex justify-between items-center gap-4"> 90 <div> 91 <div class="inline-flex items-center gap-4"> 92 <i class="w-3 h-3" data-lucide="mail"></i> 93 <p class="font-bold">{{ .Address }}</p> 94 <p class="text-sm text-gray-500">added {{ .CreatedAt | timeFmt }}</p> 95 {{ if .Verified }} 96 <span class="text-xs bg-green-100 text-green-800 px-2 py-1 rounded">verified</span> 97 {{ else }} 98 <span class="text-xs bg-yellow-100 text-yellow-800 px-2 py-1 rounded">unverified</span> 99 {{ end }} 100 {{ if .Primary }} 101 <span class="text-xs bg-blue-100 text-blue-800 px-2 py-1 rounded">primary</span> 102 {{ end }} 103 </div> 104 </div> 105 <div class="flex gap-2 items-center"> 106 {{ if not .Verified }} 107 <a 108 class="text-sm" 109 hx-post="/settings/emails/verify/resend" 110 hx-swap="none" 111 href="#" 112 hx-vals='{"email": "{{ .Address }}"}'> 113 resend verification 114 </a> 115 {{ end }} 116 {{ if and (not .Primary) .Verified }} 117 <a 118 class="text-sm" 119 hx-post="/settings/emails/primary" 120 hx-swap="none" 121 href="#" 122 hx-vals='{"email": "{{ .Address }}"}'> 123 set as primary 124 </a> 125 {{ end }} 126 {{ if not .Primary }} 127 <form hx-delete="/settings/emails" hx-confirm="Are you sure you wish to delete the email '{{ .Address }}'?"> 128 <input type="hidden" name="email" value="{{ .Address }}"> 129 <button 130 class="btn text-red-500 hover:text-red-700" 131 title="Delete email" 132 type="submit"> 133 <i class="w-5 h-5" data-lucide="trash-2"></i> 134 </button> 135 </form> 136 {{ end }} 137 </div> 138 </div> 139 {{ end }} 140 </div> 141 <form 142 hx-put="/settings/emails" 143 hx-swap="none" 144 class="max-w-2xl mb-8 space-y-4" 145 > 146 <input 147 type="email" 148 id="email" 149 name="email" 150 placeholder="your@email.com" 151 required 152 class="w-full"/> 153 154 <button class="btn" type="submit">add email</button> 155 156 <div id="settings-emails-error" class="error"></div> 157 <div id="settings-emails-success" class="success"></div> 158 159 </form> 160</section> 161{{ end }}