this repo has no description
1{{ define "title" }} 2 {{ .Pull.Title }} &middot; pull #{{ .Pull.PullId }} &middot; {{ .RepoInfo.FullName }} 3{{ end }} 4 5{{ define "repoContent" }} 6 <header class="pb-4"> 7 <h1 class="text-2xl"> 8 {{ .Pull.Title }} 9 <span class="text-gray-500">#{{ .Pull.PullId }}</span> 10 </h1> 11 </header> 12 13 {{ $bgColor := "bg-gray-800" }} 14 {{ $icon := "ban" }} 15 16 {{ if .Pull.State.IsOpen }} 17 {{ $bgColor = "bg-green-600" }} 18 {{ $icon = "git-pull-request" }} 19 {{ else if .Pull.State.IsMerged }} 20 {{ $bgColor = "bg-purple-600" }} 21 {{ $icon = "git-merge" }} 22 {{ end }} 23 24 <section> 25 <div class="flex items-center gap-2"> 26 <div 27 id="state" 28 class="inline-flex items-center rounded px-3 py-1 {{ $bgColor }}" 29 > 30 {{ i $icon "w-4 h-4 mr-1.5 text-white" }} 31 <span class="text-white">{{ .Pull.State.String }}</span> 32 </div> 33 <span class="text-gray-500 text-sm"> 34 opened by 35 {{ $owner := index $.DidHandleMap .Pull.OwnerDid }} 36 <a href="/{{ $owner }}" class="no-underline hover:underline" 37 >{{ $owner }}</a 38 > 39 <span class="select-none before:content-['\00B7']"></span> 40 <time>{{ .Pull.Created | timeFmt }}</time> 41 <span class="select-none before:content-['\00B7']"></span> 42 <span>targeting branch 43 <span class="text-xs rounded bg-gray-100 text-black font-mono px-2 mx-1/2 inline-flex items-center"> 44 {{ .Pull.TargetBranch }} 45 </span> 46 </span> 47 </span> 48 </div> 49 50 {{ if .Pull.Body }} 51 <article id="body" class="mt-2 prose"> 52 {{ .Pull.Body | markdown }} 53 </article> 54 {{ end }} 55 </section> 56 57{{ end }} 58 59{{ define "repoAfter" }} 60 <section id="submissions" class="mt-4"> 61 <div class="flex flex-col gap-4"> 62 {{ block "submissions" . }} {{ end }} 63 </div> 64 </section> 65 66 <div id="pull-close"></div> 67 <div id="pull-reopen"></div> 68{{ end }} 69 70{{ define "submissions" }} 71 {{ $lastIdx := sub (len .Pull.Submissions) 1 }} 72 {{ $targetBranch := .Pull.TargetBranch }} 73 {{ $repoName := .RepoInfo.FullName }} 74 {{ range $idx, $item := .Pull.Submissions }} 75 {{ $diff := $item.AsNiceDiff $targetBranch }} 76 {{ with $item }} 77 {{ $oneIndexedRound := add .RoundNumber 1 }} 78 <details {{ if eq $idx $lastIdx }}open{{ end }}> 79 <summary id="round-#{{ $oneIndexedRound }}" class="list-none cursor-pointer"> 80 <div class="flex gap-2 items-center"> 81 <div class="rounded bg-white drop-shadow-sm p-3"> 82 #{{ $oneIndexedRound }} 83 </div> 84 <div class="rounded drop-shadow-sm bg-white p-3 text-gray-500"> 85 <span> 86 {{ $owner := index $.DidHandleMap $.Pull.OwnerDid }} 87 submitted by <a href="/{{ $owner }}">{{ $owner }}</a> 88 <span class="select-none before:content-['\00B7']"></span> 89 <a class="text-gray-500 hover:text-gray-500" href="#round-#{{ $oneIndexedRound }}"><time>{{ .Created | timeFmt }}</time></a> 90 <span class="select-none before:content-['·']"></span> 91 {{ $s := "s" }} 92 {{ if eq (len .Comments) 1 }} 93 {{ $s = "" }} 94 {{ end }} 95 {{ len .Comments }} comment{{$s}} 96 <span class="before:content-['·']"></span> 97 <a href="/{{ $.RepoInfo.FullName }}/pulls/{{ $.Pull.PullId }}/round/{{.RoundNumber}}">view patch</a> 98 </span> 99 </div> 100 </div> 101 </summary> 102 <div class="pl-12 flex flex-col gap-2 mt-2 relative"> 103 {{ range .Comments }} 104 <div id="comment-{{.ID}}" class="bg-white rounded drop-shadow-sm py-2 px-4 relative w-fit"> 105 <div class="absolute left-8 -top-2 w-px h-2 bg-gray-300"></div> 106 <div class="text-sm text-gray-500"> 107 {{ $owner := index $.DidHandleMap .OwnerDid }} 108 <a href="/{{$owner}}">{{$owner}}</a> 109 <span class="before:content-['·']"></span> 110 <a href="#comment-{{.ID}}"><time>{{ .Created | timeFmt }}</time></a> 111 </div> 112 <div class="prose"> 113 {{ .Body }} 114 </div> 115 </div> 116 {{ end }} 117 118 {{ block "mergeStatus" $ }} {{ end }} 119 120 {{ if $.LoggedInUser }} 121 {{ block "actions" (list $ .ID) }} {{ end }} 122 {{ else }} 123 <div class="bg-white rounded drop-shadow-sm px-6 py-4 w-fit"> 124 <div class="absolute left-8 -top-2 w-px h-2 bg-gray-300"></div> 125 <a href="/login" class="underline">login</a> to join the discussion 126 </div> 127 {{ end }} 128 </div> 129 </details> 130 {{ end }} 131 {{ end }} 132{{ end }} 133 134{{ define "mergeStatus" }} 135 {{ if .Pull.State.IsMerged }} 136 <div class="bg-purple-50 border border-purple-500 rounded drop-shadow-sm px-6 py-2 relative w-fit"> 137 <div class="absolute left-8 -top-2 w-px h-2 bg-gray-300"></div> 138 <div class="flex items-center gap-2 text-purple-500"> 139 {{ i "git-merge" "w-4 h-4" }} 140 <span class="font-medium">pull request successfully merged</span 141 > 142 </div> 143 </div> 144 {{ else if and .MergeCheck .MergeCheck.IsConflicted }} 145 <div class="bg-red-50 border border-red-500 rounded drop-shadow-sm px-6 py-2 relative w-fit"> 146 <div class="absolute left-8 -top-2 w-px h-2 bg-gray-300"></div> 147 <div class="flex items-center gap-2 text-red-500"> 148 {{ i "triangle-alert" "w-4 h-4" }} 149 <span class="font-medium">merge conflicts detected</span> 150 <ul class="text-sm space-y-1"> 151 {{ range .MergeCheck.Conflicts }} 152 {{ if .Filename }} 153 <li class="flex items-center"> 154 {{ i "file-warning" "w-3 h-3 mr-1.5 text-red-500" }} 155 <span class="font-mono">{{ slice .Filename 0 (sub (len .Filename) 2) }}</span> 156 </li> 157 {{ end }} 158 {{ end }} 159 </ul> 160 </div> 161 </div> 162 {{ else if .MergeCheck }} 163 <div class="bg-green-50 border border-green-500 rounded drop-shadow-sm px-6 py-2 relative w-fit"> 164 <div class="absolute left-8 -top-2 w-px h-2 bg-gray-300"></div> 165 <div class="flex items-center gap-2 text-green-500"> 166 {{ i "circle-check-big" "w-4 h-4" }} 167 <span class="font-medium">no conflicts, ready to merge</span> 168 </div> 169 </div> 170 {{ end }} 171{{ end }} 172 173{{ define "actions" }} 174 {{ $rootObj := index . 0 }} 175 {{ $submissionId := index . 1 }} 176 177 {{ with $rootObj }} 178 {{ $isPushAllowed := .RepoInfo.Roles.IsPushAllowed }} 179 {{ $isMerged := .Pull.State.IsMerged }} 180 {{ $isClosed := .Pull.State.IsClosed }} 181 {{ $isOpen := .Pull.State.IsOpen }} 182 {{ $isConflicted := and .MergeCheck .MergeCheck.IsConflicted }} 183 {{ $isPullAuthor := and .LoggedInUser (eq .LoggedInUser.Did .Pull.OwnerDid) }} 184 <div class="relative w-fit"> 185 <div class="absolute left-8 -top-2 w-px h-2 bg-gray-300"></div> 186 <div class="flex flex-wrap gap-2"> 187 <button href="#" class="btn p-2 flex items-center gap-2 no-underline hover:no-underline"> 188 {{ i "message-square-plus" "w-4 h-4" }} 189 <span>comment</span> 190 </button> 191 {{ if and $isPushAllowed $isOpen }} 192 {{ $disabled := "" }} 193 {{ if $isConflicted }} 194 {{ $disabled = "disabled" }} 195 {{ end }} 196 <button 197 hx-post="/{{ .RepoInfo.FullName }}/pulls/{{ .Pull.PullId }}/merge" 198 hx-swap="none" 199 hx-confirm="Are you sure you want to merge this pull request?" 200 class="btn p-2 flex items-center gap-2" {{ $disabled }}> 201 {{ i "git-merge" "w-4 h-4" }} 202 <span>merge</span> 203 </button> 204 {{ end }} 205 206 {{ if and $isPullAuthor $isOpen }} 207 <button href="#" class="btn p-2 flex items-center gap-2 no-underline hover:no-underline"> 208 {{ i "rotate-ccw" "w-4 h-4" }} 209 <span>resubmit</span> 210 </button> 211 {{ end }} 212 213 {{ if and $isPullAuthor $isPushAllowed $isOpen }} 214 <button 215 hx-post="/{{ .RepoInfo.FullName }}/pulls/{{ .Pull.PullId }}/close" 216 hx-swap="none" 217 class="btn p-2 flex items-center gap-2"> 218 {{ i "ban" "w-4 h-4" }} 219 <span>close</span> 220 </button> 221 {{ end }} 222 223 {{ if and $isPullAuthor $isPushAllowed $isClosed }} 224 <button 225 hx-post="/{{ .RepoInfo.FullName }}/pulls/{{ .Pull.PullId }}/reopen" 226 hx-swap="none" 227 class="btn p-2 flex items-center gap-2"> 228 {{ i "circle-dot" "w-4 h-4" }} 229 <span>reopen</span> 230 </button> 231 {{ end }} 232 </div> 233 </div> 234 {{ end }} 235{{ end }} 236 237{{ define "newComment" }} 238 {{ $rootObj := index . 0 }} 239 {{ $submissionId := index . 1 }} 240 241 {{ with $rootObj }} 242 {{ if .LoggedInUser }} 243 <div class="bg-white rounded drop-shadow-sm py-2 px-4 relative w-full md:w-96"> 244 <div class="absolute left-8 -top-2 w-px h-2 bg-gray-300"></div> 245 <div class="text-sm text-gray-500"> 246 {{ index .DidHandleMap .LoggedInUser.Did }} 247 </div> 248 <form 249 hx-post="/{{ .RepoInfo.FullName }}/pulls/{{ .Pull.PullId }}/comment" 250 hx-swap="none"> 251 <input type="hidden" name="submissionId" value="{{ $submissionId }}"> 252 <textarea 253 name="body" 254 class="w-full border-0 h-8 focus:outline-none focus:ring-0 px-0 py-1" 255 placeholder="Add to the discussion..." /></textarea> 256 <div class="flex justify-end"> 257 <button type="submit" class="btn text-sm mt-2">comment</button> 258 </div> 259 <div id="pull-comment"></div> 260 </form> 261 </div> 262 {{ else }} 263 <div class="bg-white rounded drop-shadow-sm px-6 py-4 text-sm w-fit"> 264 <div class="absolute left-8 -top-2 w-px h-2 bg-gray-300"></div> 265 <a href="/login" class="underline">login</a> to join the discussion 266 </div> 267 {{ end }} 268 {{ end }} 269{{ end }} 270 271{{ define "alreadyMergedCard" }} 272 <div 273 id="merge-status-card" 274 class="rounded relative bg-purple-50 border border-purple-200 p-4"> 275 276 <div class="flex items-center gap-2 text-purple-500"> 277 {{ i "git-merge" "w-4 h-4" }} 278 <span class="font-medium" 279 >pull request successfully merged</span 280 > 281 </div> 282 283 <div class="mt-2 text-sm text-gray-700"> 284 <p>This pull request has been merged into the base branch.</p> 285 </div> 286 </div> 287{{ end }} 288 289{{ define "isConflictedCard" }} 290 <div 291 id="merge-status-card" 292 class="rounded relative border bg-red-50 border-red-200 p-4"> 293 294 <div class="flex items-center gap-2 text-red-500"> 295 <i data-lucide="alert-triangle" class="w-4 h-4"></i> 296 <span class="font-medium">merge conflicts detected</span> 297 </div> 298 299 <div class="mt-2"> 300 <ul class="text-sm space-y-1"> 301 {{ range .MergeCheck.Conflicts }} 302 <li class="flex items-center"> 303 <i 304 data-lucide="file-warning" 305 class="w-3 h-3 mr-1.5 text-red-500" 306 ></i> 307 <span class="font-mono" 308 >{{ slice .Filename 0 (sub (len .Filename) 2) }}</span 309 > 310 </li> 311 {{ end }} 312 </ul> 313 </div> 314 <div class="mt-3 text-sm text-gray-700"> 315 <p> 316 Please resolve these conflicts locally and update 317 the patch to continue with the merge. 318 </p> 319 </div> 320 </div> 321{{ end }} 322 323 324{{ define "noConflictsCard" }} 325 {{ $isPushAllowed := .RepoInfo.Roles.IsPushAllowed }} 326 {{ $isPullAuthor := and .LoggedInUser (eq .LoggedInUser.Did .Pull.OwnerDid) }} 327 <div 328 id="merge-status-card" 329 class="rounded relative border bg-green-50 border-green-200 p-4"> 330 331 <div class="flex items-center gap-2 text-green-500"> 332 <i data-lucide="check-circle" class="w-4 h-4"></i> 333 <span class="font-medium">ready to merge</span> 334 </div> 335 336 <div class="mt-2 text-sm text-gray-700"> 337 No conflicts detected with the base branch. This 338 pull request can be merged safely. 339 </div> 340 341 <div class="flex items-center gap-2"> 342 {{ if $isPushAllowed }} 343 <button 344 class="btn mt-4 flex items-center gap-2" 345 hx-post="/{{ .RepoInfo.FullName }}/pulls/{{ .Pull.PullId }}/merge" 346 hx-swap="none" 347 {{ if or .Pull.State.IsClosed .MergeCheck.IsConflicted }} 348 disabled 349 {{ end }}> 350 <i data-lucide="git-merge" class="w-4 h-4"></i> 351 <span>merge</span> 352 </button> 353 {{ end }} 354 355 {{ if and (or $isPullAuthor $isPushAllowed) (not .Pull.State.IsMerged) }} 356 {{ $action := "close" }} 357 {{ $icon := "circle-x" }} 358 {{ $hoverColor := "red" }} 359 {{ if .Pull.State.IsClosed }} 360 {{ $action = "reopen" }} 361 {{ $icon = "circle-dot" }} 362 {{ $hoverColor = "green" }} 363 {{ end }} 364 <button 365 hx-post="/{{ .RepoInfo.FullName }}/pulls/{{ .Pull.PullId }}/{{ $action }}" 366 hx-swap="none" 367 class="btn mt-4 flex items-center gap-2"> 368 <i data-lucide="{{ $icon }}" class="w-4 h-4 text-{{ $hoverColor }}-400"></i> 369 <span class="text-black">{{ $action }}</span> 370 </button> 371 {{ end }} 372 373 <div id="pull-merge-error" class="error"></div> 374 <div id="pull-merge-success" class="success"></div> 375 </div> 376 </div> 377{{ end }} 378 379{{ define "resubmitCard" }} 380 <div 381 id="resubmit-pull-card" 382 class="rounded relative border bg-amber-50 border-amber-200 p-4"> 383 384 <div class="flex items-center gap-2 text-amber-500"> 385 <i data-lucide="edit" class="w-4 h-4"></i> 386 <span class="font-medium">resubmit your patch</span> 387 </div> 388 389 <div class="mt-2 text-sm text-gray-700"> 390 You can update this patch to address any reviews. 391 This will begin a new round of reviews, 392 but you'll still be able to view your previous submissions and feedback. 393 </div> 394 395 <div class="mt-4 flex flex-col"> 396 <form hx-post="/{{ .RepoInfo.FullName }}/pulls/{{ .Pull.PullId }}/resubmit" class="w-full" hx-swap="none"> 397 <textarea 398 name="patch" 399 class="w-full p-2 mb-2 rounded border border-gray-200" 400 placeholder="Paste your updated patch here." 401 ></textarea> 402 <button 403 type="submit" 404 class="btn flex items-center gap-2" 405 {{ if or .Pull.State.IsClosed }} 406 disabled 407 {{ end }}> 408 <i data-lucide="refresh-ccw" class="w-4 h-4"></i> 409 <span>resubmit</span> 410 </button> 411 </form> 412 413 <div id="resubmit-error" class="error"></div> 414 <div id="resubmit-success" class="success"></div> 415 </div> 416 </div> 417{{ end }}