this repo has no description
1{{ define "title" }} 2 {{ .Pull.Title }} &middot; pull #{{ .Pull.PullId }} &middot; 3 {{ .RepoInfo.FullName }} 4{{ end }} 5 6{{ define "repoContent" }} 7 8 <header class="pb-4"> 9 <h1 class="text-2xl"> 10 {{ .Pull.Title }} 11 <span class="text-gray-500">#{{ .Pull.PullId }}</span> 12 </h1> 13 </header> 14 15 {{ $bgColor := "bg-gray-800" }} 16 {{ $icon := "ban" }} 17 18 {{ if .Pull.State.IsOpen }} 19 {{ $bgColor = "bg-green-600" }} 20 {{ $icon = "circle-dot" }} 21 {{ else if .Pull.State.IsMerged }} 22 {{ $bgColor = "bg-purple-600" }} 23 {{ $icon = "git-merge" }} 24 {{ end }} 25 26 27 <section> 28 <div class="flex items-center gap-2"> 29 <div 30 id="state" 31 class="inline-flex items-center rounded px-3 py-1 {{ $bgColor }}" 32 > 33 <i 34 data-lucide="{{ $icon }}" 35 class="w-4 h-4 mr-1.5 text-white" 36 ></i> 37 <span class="text-white">{{ .Pull.State.String }}</span> 38 </div> 39 <span class="text-gray-400 text-sm"> 40 opened by 41 {{ $owner := didOrHandle .Pull.OwnerDid .PullOwnerHandle }} 42 <a href="/{{ $owner }}" class="no-underline hover:underline" 43 >{{ $owner }}</a 44 > 45 <span class="select-none before:content-['\00B7']"></span> 46 <time>{{ .Pull.Created | timeFmt }}</time> 47 <span class="select-none before:content-['\00B7']"></span> 48 <time>targeting branch {{ .Pull.TargetBranch }}</time> 49 </span> 50 </div> 51 52 {{ if .Pull.Body }} 53 <article id="body" class="mt-8 prose"> 54 {{ .Pull.Body | markdown }} 55 </article> 56 {{ end }} 57 </section> 58 59 <div class="flex flex-col justify-end mt-4"> 60 <details> 61 <summary 62 class="list-none cursor-pointer sticky top-0 bg-white rounded-sm px-3 py-2 border border-gray-200 flex items-center text-gray-700 hover:bg-gray-50 transition-colors mt-auto" 63 > 64 <i data-lucide="code" class="w-4 h-4 mr-2"></i> 65 <span>patch</span> 66 </summary> 67 <div class="relative"> 68 <pre 69 id="patch-preview" 70 class="font-mono overflow-x-scroll bg-gray-50 p-4 rounded-b border border-gray-200 text-sm" 71 > 72 {{- .Pull.Patch -}} 73 </pre 74 > 75 <form 76 id="patch-form" 77 hx-patch="/{{ .RepoInfo.FullName }}/pulls/{{ .Pull.PullId }}/patch" 78 hx-swap="none" 79 > 80 <textarea 81 id="patch" 82 name="patch" 83 class="font-mono w-full h-full p-4 rounded-b border border-gray-200 text-sm hidden" 84 > 85{{- .Pull.Patch -}}</textarea 86 > 87 88 <div class="flex gap-2 justify-end mt-2"> 89 <button 90 id="edit-patch-btn" 91 type="button" 92 class="btn btn-sm" 93 onclick="togglePatchEdit(true)" 94 > 95 <i data-lucide="edit" class="w-4 h-4 mr-1"></i>Edit 96 </button> 97 <button 98 id="save-patch-btn" 99 type="submit" 100 class="btn btn-sm bg-green-500 hidden" 101 > 102 <i data-lucide="save" class="w-4 h-4 mr-1"></i>Save 103 </button> 104 <button 105 id="cancel-patch-btn" 106 type="button" 107 class="btn btn-sm bg-gray-300 hidden" 108 onclick="togglePatchEdit(false)" 109 > 110 Cancel 111 </button> 112 </div> 113 </form> 114 115 <div id="pull-error" class="error"></div> 116 <div id="pull-success" class="success"></div> 117 </div> 118 <script> 119 function togglePatchEdit(editMode) { 120 const preview = document.getElementById("patch-preview"); 121 const editor = document.getElementById("patch"); 122 const editBtn = document.getElementById("edit-patch-btn"); 123 const saveBtn = document.getElementById("save-patch-btn"); 124 const cancelBtn = 125 document.getElementById("cancel-patch-btn"); 126 127 if (editMode) { 128 preview.classList.add("hidden"); 129 editor.classList.remove("hidden"); 130 editBtn.classList.add("hidden"); 131 saveBtn.classList.remove("hidden"); 132 cancelBtn.classList.remove("hidden"); 133 } else { 134 preview.classList.remove("hidden"); 135 editor.classList.add("hidden"); 136 editBtn.classList.remove("hidden"); 137 saveBtn.classList.add("hidden"); 138 cancelBtn.classList.add("hidden"); 139 } 140 } 141 142 document 143 .getElementById("save-patch-btn") 144 .addEventListener("click", function () { 145 togglePatchEdit(false); 146 }); 147 </script> 148 </details> 149 </div> 150 151 {{ if .MergeCheck }} 152 <div class="mt-4" id="merge-check"> 153 <div 154 class="rounded-sm border p-4 {{ if .MergeCheck.IsConflicted }} 155 bg-red-50 border-red-200 156 {{ else }} 157 bg-green-50 border-green-200 158 {{ end }}" 159 > 160 <div 161 class="flex items-center gap-2 rounded-sm {{ if .MergeCheck.IsConflicted }} 162 text-red-500 163 {{ else }} 164 text-green-500 165 {{ end }}" 166 > 167 {{ if .MergeCheck.IsConflicted }} 168 <i data-lucide="alert-triangle" class="w-4 h-4"></i> 169 <span class="font-medium" 170 >merge conflicts detected</span 171 > 172 {{ else }} 173 <i data-lucide="check-circle" class="w-4 h-4"></i> 174 <span class="font-medium">ready to merge</span> 175 {{ end }} 176 </div> 177 178 {{ if .MergeCheck.IsConflicted }} 179 <div class="mt-2"> 180 <ul class="text-sm space-y-1"> 181 {{ range .MergeCheck.Conflicts }} 182 <li class="flex items-center"> 183 <i 184 data-lucide="file-warning" 185 class="w-3 h-3 mr-1.5 text-red-500" 186 ></i> 187 <span class="font-mono" 188 >{{ slice .Filename 0 (sub (len .Filename) 2) }}</span 189 > 190 </li> 191 {{ end }} 192 </ul> 193 </div> 194 {{ end }} 195 </div> 196 </div> 197 {{ end }} 198{{ end }} 199 200{{ define "repoAfter" }} 201 <section id="comments" class="mt-8 space-y-4 relative"> 202 {{ range $index, $comment := .Comments }} 203 <div 204 id="comment-{{ .CommentId }}" 205 class="rounded bg-white p-4 relative" 206 > 207 {{ if eq $index 0 }} 208 <div 209 class="absolute left-8 -top-8 w-px h-8 bg-gray-300" 210 ></div> 211 {{ else }} 212 <div 213 class="absolute left-8 -top-4 w-px h-4 bg-gray-300" 214 ></div> 215 {{ end }} 216 <div class="flex items-center gap-2 mb-2 text-gray-400"> 217 {{ $owner := index $.DidHandleMap .OwnerDid }} 218 <span class="text-sm"> 219 <a 220 href="/{{ $owner }}" 221 class="no-underline hover:underline" 222 >{{ $owner }}</a 223 > 224 </span> 225 <span 226 class="px-1 select-none before:content-['\00B7']" 227 ></span> 228 <a 229 href="#{{ .CommentId }}" 230 class="text-gray-500 text-sm hover:text-gray-500 hover:underline no-underline" 231 id="{{ .CommentId }}" 232 > 233 {{ .Created | timeFmt }} 234 </a> 235 </div> 236 <div class="prose"> 237 {{ .Body | markdown }} 238 </div> 239 </div> 240 {{ end }} 241 242 </section> 243 244 {{ if .LoggedInUser }} 245 <form 246 hx-post="/{{ .RepoInfo.FullName }}/pulls/{{ .Pull.PullId }}/comment" 247 class="mt-8" 248 > 249 <textarea 250 name="body" 251 class="w-full p-2 rounded border border-gray-200" 252 placeholder="Add to the discussion..." 253 ></textarea> 254 <button type="submit" class="btn mt-2">comment</button> 255 <div id="pull-comment"></div> 256 </form> 257 {{ end }} 258 259 {{ if eq .LoggedInUser.Did .Pull.OwnerDid }} 260 {{ $action := "close" }} 261 {{ $icon := "circle-x" }} 262 {{ $hoverColor := "red" }} 263 {{ if .Pull.State.IsClosed }} 264 {{ $action = "reopen" }} 265 {{ $icon = "circle-dot" }} 266 {{ $hoverColor = "green" }} 267 {{ end }} 268 <form 269 hx-post="/{{ .RepoInfo.FullName }}/pulls/{{ .Pull.PullId }}/{{ $action }}" 270 hx-swap="none" 271 class="mt-8"> 272 <button type="submit" class="btn hover:bg-{{ $hoverColor }}-300"> 273 <i 274 data-lucide="{{ $icon }}" 275 class="w-4 h-4 mr-2 text-{{ $hoverColor }}-400" 276 ></i> 277 <span class="text-black">{{ $action }}</span> 278 </button> 279 </form> 280 {{ end }} 281{{ end }}