This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

core / appview / pages / templates / repo / pulls / pull.html
26 kB 661 lines
1{{ define "title" }} 2 {{ .Pull.Title }} &middot; pull #{{ .Pull.PullId }} &middot; {{ .RepoInfo.FullName }} 3{{ end }} 4 5{{ define "extrameta" }} 6 {{ template "repo/pulls/fragments/og" (dict "RepoInfo" .RepoInfo "Pull" .Pull) }} 7{{ end }} 8 9{{ define "mainLayout" }} 10 <div class="px-1 flex-grow flex flex-col gap-4"> 11 <div class="max-w-full md:max-w-screen-lg mx-auto"> 12 {{ block "contentLayout" . }} 13 {{ block "content" . }}{{ end }} 14 {{ end }} 15 </div> 16 {{ block "contentAfterLayout" . }} 17 <main> 18 {{ block "contentAfter" . }}{{ end }} 19 </main> 20 {{ end }} 21 </div> 22 <script> 23 (function() { 24 const details = document.getElementById('bottomSheet'); 25 const backdrop = document.getElementById('bottomSheetBackdrop'); 26 const isDesktop = () => window.matchMedia('(min-width: 768px)').matches; 27 28 // function to update backdrop 29 const updateBackdrop = () => { 30 if (backdrop) { 31 if (details.open && !isDesktop()) { 32 backdrop.classList.remove('opacity-0', 'pointer-events-none'); 33 backdrop.classList.add('opacity-100', 'pointer-events-auto'); 34 document.body.style.overflow = 'hidden'; 35 } else { 36 backdrop.classList.remove('opacity-100', 'pointer-events-auto'); 37 backdrop.classList.add('opacity-0', 'pointer-events-none'); 38 document.body.style.overflow = ''; 39 } 40 } 41 }; 42 43 // close on mobile initially 44 if (!isDesktop()) { 45 details.open = false; 46 } 47 updateBackdrop(); // initialize backdrop 48 49 // prevent closing on desktop 50 details.addEventListener('toggle', function(e) { 51 if (isDesktop() && !this.open) { 52 this.open = true; 53 } 54 updateBackdrop(); 55 }); 56 57 const mediaQuery = window.matchMedia('(min-width: 768px)'); 58 mediaQuery.addEventListener('change', function(e) { 59 if (e.matches) { 60 // switched to desktop - keep open 61 details.open = true; 62 } else { 63 // switched to mobile - close 64 details.open = false; 65 } 66 updateBackdrop(); 67 }); 68 69 // close when clicking backdrop 70 if (backdrop) { 71 backdrop.addEventListener('click', () => { 72 if (!isDesktop()) { 73 details.open = false; 74 } 75 }); 76 } 77 })(); 78 </script> 79{{ end }} 80 81{{ define "repoContentLayout" }} 82 <div class="grid grid-cols-1 md:grid-cols-10 gap-4 w-full"> 83 <div class="col-span-1 md:col-span-8 flex flex-col gap-4"> 84 <section class="bg-white dark:bg-gray-800 p-6 rounded relative w-full mx-auto dark:text-white h-full flex-shrink"> 85 {{ block "repoContent" . }}{{ end }} 86 </section> 87 {{ template "repo/pulls/fragments/pullVouchNudge" . }} 88 </div> 89 <div class="flex flex-col gap-6 col-span-1 md:col-span-2"> 90 {{ template "repo/fragments/labelPanel" 91 (dict "RepoInfo" $.RepoInfo 92 "Defs" $.LabelDefs 93 "Subject" $.Pull.AtUri 94 "State" $.Pull.Labels) }} 95 {{ template "repo/fragments/participants" $.Pull.Participants }} 96 {{ template "repo/fragments/backlinks" 97 (dict "RepoInfo" $.RepoInfo 98 "Backlinks" $.Backlinks) }} 99 {{ template "repo/fragments/externalLinkPanel" $.Pull.AtUri }} 100 </div> 101 </div> 102{{ end }} 103 104{{ define "contentAfter" }} 105 <input type="hidden" id="round-link-base" value="/{{ .RepoInfo.FullName }}/pulls/{{ .Pull.PullId }}/round/{{ .ActiveRound }}" /> 106 {{ if .IsInterdiff }} 107 <input type="hidden" id="is-interdiff" value="1" /> 108 {{ end }} 109 {{ template "repo/fragments/diff" (list .Diff .DiffOpts $) }} 110{{ end }} 111 112{{ define "repoContent" }} 113 {{ template "repo/pulls/fragments/pullHeader" . }} 114 {{ if (gt (len .Stack) 1) }} 115 <div class="mt-8"> 116 {{ template "repo/pulls/fragments/pullStack" . }} 117 </div> 118 {{ end }} 119{{ end }} 120 121{{ define "resize-grip" }} 122 {{ $id := index . 0 }} 123 {{ $target := index . 1 }} 124 {{ $direction := index . 2 }} 125 <div id="{{ $id }}" 126 data-resizer="vertical" 127 data-target="{{ $target }}" 128 data-direction="{{ $direction }}" 129 class="resizer-vertical hidden md:flex w-4 sticky top-12 max-h-screen flex-col items-center justify-center group"> 130 <div class="w-1 h-16 group-hover:h-24 group-[.resizing]:h-24 transition-all rounded-full bg-gray-400 dark:bg-gray-500 group-hover:bg-gray-500 group-hover:dark:bg-gray-400"></div> 131 </div> 132{{ end }} 133 134{{ define "diffLayout" }} 135 {{ $diff := index . 0 }} 136 {{ $opts := index . 1 }} 137 {{ $root := index . 2 }} 138 139 <div class="flex col-span-full"> 140 <!-- left panel --> 141 <div id="files" class="w-0 hidden md:block overflow-hidden sticky top-12 max-h-screen overflow-y-auto pb-12"> 142 <section class="overflow-x-auto text-sm px-6 py-2 border-b border-x border-gray-200 dark:border-gray-700 w-full mx-auto min-h-full rounded-b rounded-t-none bg-white dark:bg-gray-800 shadow-sm"> 143 {{ template "repo/fragments/fileTree" $diff.FileTree }} 144 </section> 145 </div> 146 147 {{ template "resize-grip" (list "resize-files" "files" "before") }} 148 149 <!-- main content --> 150 <div id="diff-files" class="flex-1 min-w-0 sticky top-12 pb-12"> 151 {{ template "diffFiles" (list $diff $opts) }} 152 </div> 153 154 {{ template "resize-grip" (list "resize-subs" "subs" "after") }} 155 156 <!-- right panel --> 157 {{ template "subsPanel" $ }} 158 </div> 159{{ end }} 160 161{{ define "subsPanel" }} 162 {{ $root := index . 2 }} 163 {{ $pull := $root.Pull }} 164 {{ $bgColor := "bg-gray-600 dark:bg-gray-700" }} 165 166 {{ if $pull.State.IsOpen }} 167 {{ $bgColor = "bg-green-600 dark:bg-green-700" }} 168 {{ else if $pull.State.IsMerged }} 169 {{ $bgColor = "bg-purple-600 dark:bg-purple-700" }} 170 {{ else if $pull.State.IsAbandoned }} 171 {{ $bgColor = "bg-red-600 dark:bg-red-700" }} 172 {{ end }} 173 174 <!-- backdrop overlay - only visible on mobile when open --> 175 <div id="bottomSheetBackdrop" class="fixed inset-0 bg-black/50 md:hidden opacity-0 pointer-events-none transition-opacity duration-300 z-40"></div> 176 <!-- right panel - bottom sheet on mobile, side panel on desktop --> 177 <div id="subs" class="fixed bottom-0 left-0 right-0 z-50 w-full md:static md:z-auto md:max-h-screen md:sticky md:top-12 overflow-hidden"> 178 <details open id="bottomSheet" class="rounded-t-2xl md:rounded-t shadow-lg md:shadow-none group/panel"> 179 <summary class=" 180 flex gap-4 items-center justify-between 181 rounded-t-2xl md:rounded-t cursor-pointer list-none p-4 md:h-12 182 text-white md:text-black md:dark:text-white 183 {{ $bgColor }} 184 md:bg-white md:dark:bg-gray-800 185 shadow-sm border-t md:border-x border-gray-200 dark:border-gray-700 186 md:pointer-events-none 187 "> 188 <h2 class="">History</h2> 189 <span class="pointer-events-auto cursor-text"> 190 {{ template "subsPanelSummary" $ }} 191 </span> 192 </summary> 193 <div class="max-h-[85vh] md:max-h-[calc(100vh-3rem-3rem)] w-full flex flex-col-reverse gap-4 overflow-y-auto bg-slate-100 dark:bg-gray-900 md:bg-transparent"> 194 {{ template "submissions" $root }} 195 </div> 196 </details> 197 </div> 198{{ end }} 199 200{{ define "subsPanelSummary" }} 201 {{ $root := index . 2 }} 202 {{ $pull := $root.Pull }} 203 {{ $rounds := len $pull.Submissions }} 204 {{ $comments := $pull.TotalComments }} 205 <div class="flex items-center gap-2 text-sm"> 206 <span> 207 {{ $rounds }} round{{ if ne $rounds 1 }}s{{ end }} 208 </span> 209 <span class="select-none before:content-['\00B7']"></span> 210 <span> 211 {{ $comments }} comment{{ if ne $comments 1 }}s{{ end }} 212 </span> 213 214 <span class="md:hidden inline"> 215 <span class="inline group-open:hidden">{{ i "chevron-up" "size-4" }}</span> 216 <span class="hidden group-open:inline">{{ i "chevron-down" "size-4" }}</span> 217 </span> 218 </div> 219{{ end }} 220 221{{ define "subsCheckbox" }} 222 <input type="checkbox" id="subsToggle" class="peer/subs hidden" checked/> 223{{ end }} 224 225{{ define "subsToggle" }} 226 <style> 227 #subsToggle:checked ~ div div#subs { 228 width: 100%; 229 margin-left: 0; 230 } 231 #subsToggle:checked ~ div label[for="subsToggle"] .show-toggle { display: none; } 232 #subsToggle:checked ~ div label[for="subsToggle"] .hide-toggle { display: flex; } 233 #subsToggle:not(:checked) ~ div label[for="subsToggle"] .hide-toggle { display: none; } 234 235 @media (min-width: 768px) { 236 #subsToggle:checked ~ div div#subs { 237 width: 25vw; 238 max-width: 50vw; 239 } 240 #subsToggle:not(:checked) ~ div div#subs { 241 width: 0; 242 display: none; 243 margin-left: 0; 244 } 245 #subsToggle:not(:checked) ~ div div#resize-subs { 246 display: none; 247 } 248 } 249 </style> 250 <label title="Toggle review panel" for="subsToggle" class="hidden md:flex items-center justify-end pointer-events-none"> 251 <span class="show-toggle hit-area hit-area-4 hit-area-x-2 pointer-events-auto cursor-pointer">{{ i "message-square-more" "size-4" }}</span> 252 <span class="hide-toggle w-[25vw] justify-end"><span class="hit-area hit-area-4 hit-area-x-2 pointer-events-auto cursor-pointer">{{ i "message-square" "size-4" }}</span></span> 253 </label> 254{{ end }} 255 256 257{{ define "submissions" }} 258 {{ $lastIdx := sub (len .Pull.Submissions) 1 }} 259 {{ if not .LoggedInUser }} 260 {{ template "loginPrompt" $ }} 261 {{ end }} 262 {{ range $ridx, $item := reverse .Pull.Submissions }} 263 {{ $idx := sub $lastIdx $ridx }} 264 {{ template "submission" (list $item $idx $lastIdx $) }} 265 {{ end }} 266{{ end }} 267 268{{ define "submission" }} 269 {{ $item := index . 0 }} 270 {{ $idx := index . 1 }} 271 {{ $lastIdx := index . 2 }} 272 {{ $root := index . 3 }} 273 {{ $round := $item.RoundNumber }} 274 <div class=" 275 w-full shadow-sm border overflow-clip 276 277 {{ if eq $round 0 }}rounded-b{{ else }}rounded{{ end }} 278 {{ if eq $round $root.ActiveRound }} 279 bg-blue-50/25 dark:bg-blue-900/10 border-blue-200 dark:border-blue-900 280 {{ else }} 281 bg-gray-50 dark:bg-gray-900 border-gray-200 dark:border-gray-700 282 {{ end }} 283 "> 284 {{ template "submissionHeader" $ }} 285 {{ template "submissionComments" $ }} 286 </div> 287{{ end }} 288 289{{ define "submissionHeader" }} 290 {{ $item := index . 0 }} 291 {{ $lastIdx := index . 2 }} 292 {{ $root := index . 3 }} 293 {{ $round := $item.RoundNumber }} 294 <div class=" 295 {{ if ne $round 0 }}rounded-t{{ end }} 296 px-6 py-4 pr-2 pt-2 297 {{ if eq $round $root.ActiveRound }} 298 bg-blue-50 dark:bg-blue-950 299 {{ else }} 300 bg-white dark:bg-gray-800 301 {{ end }} 302 303 flex gap-2 sticky top-0 z-20"> 304 <!-- left column: just profile picture --> 305 <div class="flex-shrink-0 pt-2"> 306 {{ template "user/fragments/picLink" (list $root.Pull.OwnerDid "size-8" (index $root.VouchRelationships (did $root.Pull.OwnerDid))) }} 307 </div> 308 <!-- right column --> 309 <div class="flex-1 min-w-0 flex flex-col gap-1"> 310 {{ template "submissionInfo" $ }} 311 {{ template "submissionCommits" $ }} 312 {{ template "submissionPipeline" $ }} 313 {{ if eq $lastIdx $round }} 314 {{ block "mergeCheck" $root }} {{ end }} 315 {{ end }} 316 </div> 317 </div> 318{{ end }} 319 320{{ define "submissionInfo" }} 321 {{ $item := index . 0 }} 322 {{ $idx := index . 1 }} 323 {{ $root := index . 3 }} 324 {{ $round := $item.RoundNumber }} 325 <div class="flex gap-2 items-center justify-between mb-1"> 326<span class="inline-flex items-center gap-2 text-sm 327 {{ if eq $round $root.ActiveRound }} 328 text-gray-600 dark:text-gray-300 329 {{ else }} 330 text-gray-500 dark:text-gray-400 331 {{ end }} 332 pt-2"> 333 {{ $handle := resolve $root.Pull.OwnerDid }} 334 <a class=" 335 {{ if eq $round $root.ActiveRound }} 336 text-gray-800 dark:text-gray-300 hover:text-gray-800 dark:hover:text-gray-200 337 {{ else }} 338 text-gray-500 dark:text-gray-400 hover:text-gray-500 dark:hover:text-gray-300 339 {{ end }} 340 " href="/{{ $handle }}">{{ $handle }}</a> 341 submitted 342 <span class="px-2 py-0.5 rounded font-mono text-xs border 343 {{ if eq $round $root.ActiveRound }} 344 text-blue-800 dark:text-white bg-blue-100 dark:bg-blue-600 border-blue-200 dark:border-blue-500 345 {{ else }} 346 text-black dark:text-white bg-gray-100 dark:bg-gray-700 border-gray-300 dark:border-gray-600 347 {{ end }} 348 "> 349 #{{ $round }} 350 </span> 351 <span class="select-none before:content-['\00B7']"></span> 352 <a class=" 353 {{ if eq $round $root.ActiveRound }} 354 text-gray-600 dark:text-gray-300 hover:text-gray-600 dark:hover:text-gray-200 355 {{ else }} 356 text-gray-500 dark:text-gray-400 hover:text-gray-500 dark:hover:text-gray-300 357 {{ end }} 358 " href="#round-#{{ $round }}"> 359 {{ template "repo/fragments/shortTime" $item.Created }} 360 </a> 361 </span> 362 <div class="flex gap-2 items-center"> 363 {{ if or $root.IsInterdiff (ne $root.ActiveRound $round) }} 364 <a class="btn-flat flex items-center gap-2 no-underline hover:no-underline text-sm" 365 href="/{{ $root.RepoInfo.FullName }}/pulls/{{ $root.Pull.PullId }}/round/{{ $round }}?{{ safeUrl $root.DiffOpts.Encode }}#round-#{{ $round }}"> 366 {{ i "diff" "w-4 h-4" }} 367 diff 368 </a> 369 {{ end }} 370 {{ if and (ne $idx 0) (or (not $root.IsInterdiff) (ne $root.ActiveRound $round)) }} 371 <a class="btn-flat flex items-center gap-2 no-underline hover:no-underline text-sm" 372 href="/{{ $root.RepoInfo.FullName }}/pulls/{{ $root.Pull.PullId }}/round/{{ $round }}/interdiff?{{ safeUrl $root.DiffOpts.Encode }}"> 373 {{ i "chevrons-left-right-ellipsis" "w-4 h-4 rotate-90" }} 374 interdiff 375 </a> 376 {{ end }} 377 </div> 378 </div> 379{{ end }} 380 381{{ define "submissionCommits" }} 382 {{ $item := index . 0 }} 383 {{ $root := index . 3 }} 384 {{ $round := $item.RoundNumber }} 385 {{ $patches := $item.AsFormatPatch }} 386 {{ if $patches }} 387 <details class="group/commit"> 388 <summary class="list-none cursor-pointer flex items-center gap-2"> 389 <span>{{ i "git-commit-horizontal" "w-4 h-4" }}</span> 390 {{ len $patches }} commit{{ if ne (len $patches) 1 }}s{{ end }} 391 <div class="text-sm text-gray-500 dark:text-gray-400"> 392 <span class="group-open/commit:hidden inline">expand</span> 393 <span class="hidden group-open/commit:inline">collapse</span> 394 </div> 395 </summary> 396 {{ range $patches }} 397 {{ template "submissionCommit" (list . $item $root) }} 398 {{ end }} 399 </details> 400 {{ end }} 401{{ end }} 402 403{{ define "submissionCommit" }} 404 {{ $patch := index . 0 }} 405 {{ $item := index . 1 }} 406 {{ $root := index . 2 }} 407 {{ $round := $item.RoundNumber }} 408 {{ with $patch }} 409 <div id="commit-{{.SHA}}" class="py-1 relative w-full md:max-w-3/5 md:w-fit flex flex-col text-gray-600 dark:text-gray-300"> 410 <div class="flex items-baseline gap-2"> 411 <div class="text-xs"> 412 <!-- attempt to resolve $fullRepo: this is possible only on non-deleted forks and branches --> 413 {{ $fullRepo := "" }} 414 {{ if and $root.Pull.IsForkBased $root.Pull.PullSource.Repo }} 415 {{ $fullRepo = printf "%s/%s" (resolve $root.Pull.PullSource.Repo.Did) $root.Pull.PullSource.Repo.Slug }} 416 {{ else if $root.Pull.IsBranchBased }} 417 {{ $fullRepo = $root.RepoInfo.FullName }} 418 {{ end }} 419 420 <!-- if $fullRepo was resolved, link to it, otherwise just span without a link --> 421 {{ if $fullRepo }} 422 <a href="/{{ $fullRepo }}/commit/{{ .SHA }}" class="font-mono text-gray-600 dark:text-gray-300">{{ slice .SHA 0 8 }}</a> 423 {{ else }} 424 <span class="font-mono">{{ slice .SHA 0 8 }}</span> 425 {{ end }} 426 </div> 427 428 <div> 429 <span>{{ .Title | description }}</span> 430 {{ if gt (len .Body) 0 }} 431 <button 432 class="py-1/2 px-1 mx-2 bg-gray-200 hover:bg-gray-400 rounded dark:bg-gray-700 dark:hover:bg-gray-600" 433 hx-on:click="document.getElementById('body-{{$round}}-{{.SHA}}').classList.toggle('hidden')" 434 > 435 {{ i "ellipsis" "w-3 h-3" }} 436 </button> 437 {{ end }} 438 {{ if gt (len .Body) 0 }} 439 <p id="body-{{$round}}-{{.SHA}}" class="hidden mt-1 pb-2">{{ nl2br .Body }}</p> 440 {{ end }} 441 </div> 442 </div> 443 </div> 444 {{ end }} 445{{ end }} 446 447{{ define "mergeCheck" }} 448 {{ $isOpen := .Pull.State.IsOpen }} 449 {{ if and $isOpen .MergeCheck .MergeCheck.Error }} 450 <div class="flex items-center gap-2"> 451 {{ i "triangle-alert" "w-4 h-4 text-red-600 dark:text-red-500" }} 452 {{ .MergeCheck.Error }} 453 </div> 454 {{ else if and $isOpen .MergeCheck .MergeCheck.IsConflicted }} 455 <details class="group/conflict"> 456 <summary class="flex items-center justify-between cursor-pointer list-none"> 457 <div class="flex items-center gap-2 "> 458 {{ i "triangle-alert" "text-red-600 dark:text-red-500 w-4 h-4" }} 459 <span class="font-medium">merge conflicts detected</span> 460 <div class="text-sm text-gray-500 dark:text-gray-400"> 461 <span class="group-open/conflict:hidden inline">expand</span> 462 <span class="hidden group-open/conflict:inline">collapse</span> 463 </div> 464 </div> 465 </summary> 466 {{ if gt (len .MergeCheck.Conflicts) 0 }} 467 <ul class="space-y-1 mt-2 overflow-x-auto"> 468 {{ range .MergeCheck.Conflicts }} 469 {{ if .Filename }} 470 <li class="flex items-center whitespace-nowrap"> 471 {{ i "file-warning" "inline-flex w-4 h-4 mr-1.5 text-red-600 dark:text-red-500 flex-shrink-0" }} 472 <span class="font-mono">{{ .Filename }}</span> 473 </li> 474 {{ else if .Reason }} 475 <li class="flex items-center whitespace-nowrap"> 476 {{ i "file-warning" "w-4 h-4 mr-1.5 text-red-600 dark:text-red-500 " }} 477 <span>{{.Reason}}</span> 478 </li> 479 {{ end }} 480 {{ end }} 481 </ul> 482 {{ end }} 483 </details> 484 {{ else if and $isOpen .MergeCheck }} 485 <div class="flex items-center gap-2"> 486 {{ i "check" "w-4 h-4 text-green-600 dark:text-green-500" }} 487 <span>no conflicts, ready to merge</span> 488 </div> 489 {{ end }} 490{{ end }} 491 492{{ define "mergeStatus" }} 493 {{ if .Pull.State.IsClosed }} 494 <div class="bg-gray-50 dark:bg-gray-700 border border-black dark:border-gray-500 rounded shadow-sm px-6 py-2 relative"> 495 <div class="flex items-center gap-2 text-black dark:text-white"> 496 {{ i "ban" "w-4 h-4" }} 497 <span class="font-medium">closed without merging</span 498 > 499 </div> 500 </div> 501 {{ else if .Pull.State.IsMerged }} 502 <div class="bg-purple-50 dark:bg-purple-900 border border-purple-500 rounded shadow-sm px-6 py-2 relative"> 503 <div class="flex items-center gap-2 text-purple-500 dark:text-purple-300"> 504 {{ i "git-merge" "w-4 h-4" }} 505 <span class="font-medium">pull request successfully merged</span 506 > 507 </div> 508 </div> 509 {{ else if .Pull.State.IsAbandoned }} 510 <div class="bg-red-50 dark:bg-red-900 border border-red-500 rounded shadow-sm px-6 py-2 relative"> 511 <div class="flex items-center gap-2 text-red-500 dark:text-red-300"> 512 {{ i "git-pull-request-closed" "w-4 h-4" }} 513 <span class="font-medium">This pull has been deleted (possibly by jj abandon or jj squash)</span> 514 </div> 515 </div> 516 {{ end }} 517{{ end }} 518 519{{ define "resubmitStatus" }} 520 {{ if .ResubmitCheck.Yes }} 521 <div class="bg-amber-50 dark:bg-amber-900 border border-amber-500 rounded shadow-sm px-6 py-2 relative"> 522 <div class="flex items-center gap-2 text-amber-500 dark:text-amber-300"> 523 {{ i "triangle-alert" "w-4 h-4" }} 524 <span class="font-medium">this branch has been updated, consider resubmitting</span> 525 </div> 526 </div> 527 {{ end }} 528{{ end }} 529 530{{ define "submissionPipeline" }} 531 {{ $item := index . 0 }} 532 {{ $root := index . 3 }} 533 {{ $pipeline := index $root.Pipelines $item.SourceRev }} 534 {{ with $pipeline }} 535 {{ $id := .Id }} 536 {{ if .Statuses }} 537 <details class="group/pipeline"> 538 <summary class="cursor-pointer list-none flex items-center gap-2"> 539 {{ template "repo/pipelines/fragments/pipelineSymbol" (dict "Pipeline" $pipeline "ShortSummary" false) }} 540 <div class="text-sm text-gray-500 dark:text-gray-400"> 541 <span class="group-open/pipeline:hidden inline">expand</span> 542 <span class="hidden group-open/pipeline:inline">collapse</span> 543 </div> 544 </summary> 545 <div class="my-2 grid grid-cols-1 bg-white dark:bg-gray-800 rounded border border-gray-200 dark:border-gray-700 divide-y divide-gray-200 dark:divide-gray-700"> 546 {{ range $name, $all := .Statuses }} 547 <a href="/{{ $root.RepoInfo.FullName }}/pipelines/{{ $id }}/workflow/{{ $name }}" class="no-underline hover:no-underline hover:bg-gray-100/25 hover:dark:bg-gray-700/25"> 548 <div 549 class="flex gap-2 items-center justify-between p-2"> 550 {{ $lastStatus := $all.Latest }} 551 {{ $kind := $lastStatus.Status.String }} 552 553 <div id="left" class="flex items-center gap-2 flex-shrink-0"> 554 {{ template "repo/pipelines/fragments/workflowSymbol" $all }} 555 {{ $name }} 556 </div> 557 <div id="right" class="flex items-center gap-2 flex-shrink-0"> 558 <span class="font-bold">{{ $kind }}</span> 559 {{ if .TimeTaken }} 560 {{ template "repo/fragments/duration" .TimeTaken }} 561 {{ else }} 562 {{ template "repo/fragments/shortTimeAgo" $lastStatus.Created }} 563 {{ end }} 564 </div> 565 </div> 566 </a> 567 {{ end }} 568 </div> 569 </details> 570 {{ end }} 571 {{ end }} 572{{ end }} 573 574{{ define "submissionComments" }} 575 {{ $item := index . 0 }} 576 {{ $idx := index . 1 }} 577 {{ $lastIdx := index . 2 }} 578 {{ $root := index . 3 }} 579 {{ $round := $item.RoundNumber }} 580 {{ $c := len $item.Comments }} 581 <details class="relative ml-10 group/comments group/collapse" {{ if or (eq $c 0) (eq $root.ActiveRound $round) }}open{{ end }}> 582 <summary class="cursor-pointer list-none"> 583 <div class="hidden group-open/comments:block absolute -left-8 top-0 bottom-0 w-16 transition-colors flex items-center justify-center group/border z-4"> 584 <div class="absolute left-1/2 -translate-x-1/2 top-0 bottom-0 w-0.5 group-open/comments:bg-gray-200 dark:group-open/comments:bg-gray-700 group-hover/border:bg-gray-400 dark:group-hover/border:bg-gray-500 group-hover/collapse:bg-gray-400 dark:group-hover/collapse:bg-gray-500 transition-colors"> </div> 585 </div> 586 <div class="group-open/comments:hidden block relative group/summary py-4"> 587 <div class="absolute -left-8 top-0 bottom-0 w-16 transition-colors flex items-center justify-center z-4"> 588 <div class="absolute left-1/2 -translate-x-1/2 h-1/3 top-0 bottom-0 w-0.5 bg-gray-200 dark:bg-gray-700 group-hover/summary:bg-gray-400 dark:group-hover/summary:bg-gray-500 transition-colors"></div> 589 </div> 590 <span class="text-gray-500 dark:text-gray-400 text-sm group-hover/summary:text-gray-600 dark:group-hover/summary:text-gray-300 transition-colors flex items-center gap-2 -ml-2 relative"> 591 {{ i "circle-plus" "size-4 z-5" }} 592 expand {{ $c }} comment{{ if ne $c 1 }}s{{ end }} 593 </span> 594 </div> 595 </summary> 596 <div> 597 {{ range $item.Comments }} 598 {{/* template "submissionComment" . */}} 599 {{ template "comment" 600 (dict "LoggedInUser" $root.LoggedInUser 601 "Reactions" (index (asReactionMapMap $root.Reactions) .AtUri) 602 "UserReacted" (index (asReactionStatusMapMap $root.UserReacted) .AtUri) 603 "VouchRelationship" (index $root.VouchRelationships .Did) 604 "Comment" .) }} 605 {{ end }} 606 </div> 607 {{ if gt $c 0}} 608 <button class="flex items-center gap-2 -ml-2 relative cursor-pointer text-sm text-gray-500 dark:text-gray-400 group-hover/collapse:text-gray-600 dark:group-hover/collapse:text-gray-300 mt-4 pb-4 transition-colors" hx-on:click="this.closest('details').open = false"> 609 <span class="bg-gray-50 dark:bg-slate-900 dark:rounded-full">{{ i "circle-chevron-up" "size-4 z-5" }}</span> collapse comment{{ if ne $c 1 }}s{{ end }} 610 </button> 611 {{ end }} 612 613 <div class="relative -ml-10"> 614 {{ if eq $lastIdx $item.RoundNumber }} 615 {{ block "mergeStatus" $root }} {{ end }} 616 {{ block "resubmitStatus" $root }} {{ end }} 617 {{ end }} 618 </div> 619 <div hx-include="this" class="relative -ml-10 bg-gray-50 dark:bg-gray-900"> 620 {{ if $root.LoggedInUser }} 621 <input name="subject-uri" type="hidden" value="{{ $root.Pull.AtUri }}"> 622 <input name="pull-round-idx" type="hidden" value="{{ $item.RoundNumber }}"> 623 {{ template "repo/pulls/fragments/pullActions" 624 (dict 625 "LoggedInUser" $root.LoggedInUser 626 "Pull" $root.Pull 627 "RepoInfo" $root.RepoInfo 628 "RoundNumber" $item.RoundNumber 629 "MergeCheck" $root.MergeCheck 630 "ResubmitCheck" $root.ResubmitCheck 631 "BranchDeleteStatus" $root.BranchDeleteStatus 632 "Stack" $root.Stack) }} 633 {{ end }} 634 </div> 635 </details> 636{{ end }} 637 638{{ define "comment" }} 639<div class="flex gap-2 -ml-4 py-4 w-full mx-auto"> 640 <!-- left column: profile picture --> 641 <div class="flex-shrink-0 h-fit relative"> 642 {{ template "user/fragments/picLink" (list .Comment.Did.String "size-8") }} 643 </div> 644 <!-- right column: name and body in two rows --> 645 <div class="flex-1 min-w-0"> 646 {{ template "fragments/comment/commentHeader" . }} 647 {{ template "fragments/comment/commentBody" . }} 648 </div> 649</div> 650{{ end }} 651 652{{ define "loginPrompt" }} 653 <div class="bg-amber-50 dark:bg-amber-900 border border-amber-500 rounded shadow-sm p-2 relative flex gap-2 items-center"> 654 <a href="/signup" class="btn-create py-0 hover:no-underline hover:text-white flex items-center gap-2"> 655 sign up 656 </a> 657 <span class="text-gray-500 dark:text-gray-400">or</span> 658 <a href="/login" class="underline">login</a> 659 to add to the discussion 660 </div> 661{{ end }}