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