1{{ define "title" }}pulls · {{ .RepoInfo.FullName }}{{ end }}
2
3{{ define "extrameta" }}
4 {{ $title := "pulls"}}
5 {{ $url := printf "https://tangled.sh/%s/pulls" .RepoInfo.FullName }}
6
7 {{ template "repo/fragments/og" (dict "RepoInfo" .RepoInfo "Title" $title "Url" $url) }}
8{{ end }}
9
10{{ define "repoContent" }}
11 <div class="flex justify-between items-center">
12 <div class="flex gap-4">
13 <a
14 href="?state=open"
15 class="flex items-center gap-2 {{ if .FilteringBy.IsOpen }}font-bold {{ else }}text-gray-500 dark:text-gray-400{{ end }}"
16 >
17 {{ i "git-pull-request" "w-4 h-4" }}
18 <span>{{ .RepoInfo.Stats.PullCount.Open }} open</span>
19 </a>
20 <a
21 href="?state=merged"
22 class="flex items-center gap-2 {{ if .FilteringBy.IsMerged }}font-bold {{ else }}text-gray-500 dark:text-gray-400{{ end }}"
23 >
24 {{ i "git-merge" "w-4 h-4" }}
25 <span>{{ .RepoInfo.Stats.PullCount.Merged }} merged</span>
26 </a>
27 <a
28 href="?state=closed"
29 class="flex items-center gap-2 {{ if .FilteringBy.IsClosed }}font-bold {{ else }}text-gray-500 dark:text-gray-400{{ end }}"
30 >
31 {{ i "ban" "w-4 h-4" }}
32 <span>{{ .RepoInfo.Stats.PullCount.Closed }} closed</span>
33 </a>
34 </div>
35 <a
36 href="/{{ .RepoInfo.FullName }}/pulls/new"
37 class="btn-create text-sm flex items-center gap-2 no-underline hover:no-underline hover:text-white"
38 >
39 {{ i "git-pull-request-create" "w-4 h-4" }}
40 <span>new</span>
41 </a>
42 </div>
43 <div class="error" id="pulls"></div>
44{{ end }}
45
46{{ define "repoAfter" }}
47 <div class="flex flex-col gap-2 mt-2">
48 {{ range .Pulls }}
49 <div class="rounded bg-white dark:bg-gray-800">
50 <div class="px-6 py-4 z-5">
51 <div class="pb-2">
52 <a href="/{{ $.RepoInfo.FullName }}/pulls/{{ .PullId }}" class="dark:text-white">
53 {{ .Title }}
54 <span class="text-gray-500 dark:text-gray-400">#{{ .PullId }}</span>
55 </a>
56 </div>
57 <div class="text-sm text-gray-500 dark:text-gray-400 flex flex-wrap items-center gap-1">
58 {{ $bgColor := "bg-gray-800 dark:bg-gray-700" }}
59 {{ $icon := "ban" }}
60
61 {{ if .State.IsOpen }}
62 {{ $bgColor = "bg-green-600 dark:bg-green-700" }}
63 {{ $icon = "git-pull-request" }}
64 {{ else if .State.IsMerged }}
65 {{ $bgColor = "bg-purple-600 dark:bg-purple-700" }}
66 {{ $icon = "git-merge" }}
67 {{ end }}
68
69
70 <span
71 class="inline-flex items-center rounded px-2 py-[5px] {{ $bgColor }} text-sm"
72 >
73 {{ i $icon "w-3 h-3 mr-1.5 text-white" }}
74 <span class="text-white">{{ .State.String }}</span>
75 </span>
76
77 <span class="ml-1">
78 {{ template "user/fragments/picHandleLink" .OwnerDid }}
79 </span>
80
81 <span class="before:content-['·']">
82 {{ template "repo/fragments/time" .Created }}
83 </span>
84
85
86 {{ $latestRound := .LastRoundNumber }}
87 {{ $lastSubmission := index .Submissions $latestRound }}
88
89 <span class="before:content-['·']">
90 {{ $commentCount := len $lastSubmission.Comments }}
91 {{ $s := "s" }}
92 {{ if eq $commentCount 1 }}
93 {{ $s = "" }}
94 {{ end }}
95
96 {{ len $lastSubmission.Comments}} comment{{$s}}
97 </span>
98
99 <span class="before:content-['·']">
100 round
101 <span class="font-mono">
102 #{{ .LastRoundNumber }}
103 </span>
104 </span>
105
106 {{ $pipeline := index $.Pipelines .LatestSha }}
107 {{ if and $pipeline $pipeline.Id }}
108 <span class="before:content-['·']"></span>
109 {{ template "repo/pipelines/fragments/pipelineSymbol" $pipeline }}
110 {{ end }}
111 </div>
112 </div>
113 {{ if .StackId }}
114 {{ $otherPulls := index $.Stacks .StackId }}
115 {{ if gt (len $otherPulls) 0 }}
116 <details class="bg-white dark:bg-gray-800 group">
117 <summary class="pb-4 px-6 text-xs list-none cursor-pointer hover:text-gray-500 hover:dark:text-gray-400">
118 {{ $s := "s" }}
119 {{ if eq (len $otherPulls) 1 }}
120 {{ $s = "" }}
121 {{ end }}
122 <div class="group-open:hidden flex items-center gap-2">
123 {{ i "chevrons-up-down" "w-4 h-4" }} expand {{ len $otherPulls }} pull{{$s}} in this stack
124 </div>
125 <div class="hidden group-open:flex items-center gap-2">
126 {{ i "chevrons-down-up" "w-4 h-4" }} hide {{ len $otherPulls }} pull{{$s}} in this stack
127 </div>
128 </summary>
129 {{ block "pullList" (list $otherPulls $) }} {{ end }}
130 </details>
131 {{ end }}
132 {{ end }}
133 </div>
134 {{ end }}
135 </div>
136{{ end }}
137
138{{ define "pullList" }}
139 {{ $list := index . 0 }}
140 {{ $root := index . 1 }}
141 <div class="grid grid-cols-1 rounded-b border-b border-t border-gray-200 dark:border-gray-900 divide-y divide-gray-200 dark:divide-gray-900">
142 {{ range $pull := $list }}
143 {{ $pipeline := index $root.Pipelines $pull.LatestSha }}
144 <a href="/{{ $root.RepoInfo.FullName }}/pulls/{{ $pull.PullId }}" class="no-underline hover:no-underline hover:bg-gray-100/25 hover:dark:bg-gray-700/25">
145 <div class="flex gap-2 items-center px-6">
146 <div class="flex-grow min-w-0 w-full py-2">
147 {{ template "repo/pulls/fragments/summarizedHeader" (list $pull $pipeline) }}
148 </div>
149 </div>
150 </a>
151 {{ end }}
152 </div>
153{{ end }}