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