1{{ define "title" }}pulls · {{ .RepoInfo.FullName }}{{ end }}
2
3{{ define "extrameta" }}
4 {{ $title := "pulls"}}
5 {{ $url := printf "https://tangled.org/%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 <form class="flex gap-4" method="GET">
35 <input type="hidden" name="state" value="{{ .FilteringBy.String }}">
36 <input class="" type="text" name="q" value="{{ .FilterQuery }}">
37 <button class="btn" type="submit">
38 search
39 </button>
40 </form>
41 </div>
42 <a
43 href="/{{ .RepoInfo.FullName }}/pulls/new"
44 class="btn-create text-sm flex items-center gap-2 no-underline hover:no-underline hover:text-white"
45 >
46 {{ i "git-pull-request-create" "w-4 h-4" }}
47 <span>new</span>
48 </a>
49 </div>
50 <div class="error" id="pulls"></div>
51{{ end }}
52
53{{ define "repoAfter" }}
54 <div class="flex flex-col gap-2 mt-2">
55 {{ range .Pulls }}
56 <div class="rounded bg-white dark:bg-gray-800">
57 <div class="px-6 py-4 z-5">
58 <div class="pb-2">
59 <a href="/{{ $.RepoInfo.FullName }}/pulls/{{ .PullId }}" class="dark:text-white">
60 {{ .Title | description }}
61 <span class="text-gray-500 dark:text-gray-400">#{{ .PullId }}</span>
62 </a>
63 </div>
64 <div class="text-sm text-gray-500 dark:text-gray-400 flex flex-wrap items-center gap-1">
65 {{ $bgColor := "bg-gray-800 dark:bg-gray-700" }}
66 {{ $icon := "ban" }}
67
68 {{ if .State.IsOpen }}
69 {{ $bgColor = "bg-green-600 dark:bg-green-700" }}
70 {{ $icon = "git-pull-request" }}
71 {{ else if .State.IsMerged }}
72 {{ $bgColor = "bg-purple-600 dark:bg-purple-700" }}
73 {{ $icon = "git-merge" }}
74 {{ end }}
75
76
77 <span
78 class="inline-flex items-center rounded px-2 py-[5px] {{ $bgColor }} text-sm"
79 >
80 {{ i $icon "w-3 h-3 mr-1.5 text-white" }}
81 <span class="text-white">{{ .State.String }}</span>
82 </span>
83
84 <span class="ml-1">
85 {{ template "user/fragments/picHandleLink" .OwnerDid }}
86 </span>
87
88 <span class="before:content-['·']">
89 {{ template "repo/fragments/time" .Created }}
90 </span>
91
92
93 {{ $latestRound := .LastRoundNumber }}
94 {{ $lastSubmission := index .Submissions $latestRound }}
95
96 <span class="before:content-['·']">
97 {{ $commentCount := len $lastSubmission.Comments }}
98 {{ $s := "s" }}
99 {{ if eq $commentCount 1 }}
100 {{ $s = "" }}
101 {{ end }}
102
103 {{ len $lastSubmission.Comments}} comment{{$s}}
104 </span>
105
106 <span class="before:content-['·']">
107 round
108 <span class="font-mono">
109 #{{ .LastRoundNumber }}
110 </span>
111 </span>
112
113 {{ $pipeline := index $.Pipelines .LatestSha }}
114 {{ if and $pipeline $pipeline.Id }}
115 <span class="before:content-['·']"></span>
116 {{ template "repo/pipelines/fragments/pipelineSymbol" $pipeline }}
117 {{ end }}
118
119 {{ $state := .Labels }}
120 {{ range $k, $d := $.LabelDefs }}
121 {{ range $v, $s := $state.GetValSet $d.AtUri.String }}
122 {{ template "labels/fragments/label" (dict "def" $d "val" $v "withPrefix" true) }}
123 {{ end }}
124 {{ end }}
125 </div>
126 </div>
127 {{ if .StackId }}
128 {{ $otherPulls := index $.Stacks .StackId }}
129 {{ if gt (len $otherPulls) 0 }}
130 <details class="bg-white dark:bg-gray-800 group">
131 <summary class="pb-4 px-6 text-xs list-none cursor-pointer hover:text-gray-500 hover:dark:text-gray-400">
132 {{ $s := "s" }}
133 {{ if eq (len $otherPulls) 1 }}
134 {{ $s = "" }}
135 {{ end }}
136 <div class="group-open:hidden flex items-center gap-2">
137 {{ i "chevrons-up-down" "w-4 h-4" }} expand {{ len $otherPulls }} pull{{$s}} in this stack
138 </div>
139 <div class="hidden group-open:flex items-center gap-2">
140 {{ i "chevrons-down-up" "w-4 h-4" }} hide {{ len $otherPulls }} pull{{$s}} in this stack
141 </div>
142 </summary>
143 {{ block "pullList" (list $otherPulls $) }} {{ end }}
144 </details>
145 {{ end }}
146 {{ end }}
147 </div>
148 {{ end }}
149 </div>
150{{ end }}
151
152{{ define "pullList" }}
153 {{ $list := index . 0 }}
154 {{ $root := index . 1 }}
155 <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">
156 {{ range $pull := $list }}
157 {{ $pipeline := index $root.Pipelines $pull.LatestSha }}
158 <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">
159 <div class="flex gap-2 items-center px-6">
160 <div class="flex-grow min-w-0 w-full py-2">
161 {{ template "repo/pulls/fragments/summarizedPullHeader" (list $pull $pipeline) }}
162 </div>
163 </div>
164 </a>
165 {{ end }}
166 </div>
167{{ end }}