+70
appview/pages/templates/repo/pulls/fragments/pullHeader.html
+70
appview/pages/templates/repo/pulls/fragments/pullHeader.html
···
1
+
{{ define "repo/pulls/fragments/pullHeader" }}
2
+
<header class="pb-4">
3
+
<h1 class="text-2xl dark:text-white">
4
+
{{ .Pull.Title }}
5
+
<span class="text-gray-500 dark:text-gray-400">#{{ .Pull.PullId }}</span>
6
+
</h1>
7
+
</header>
8
+
9
+
{{ $bgColor := "bg-gray-800 dark:bg-gray-700" }}
10
+
{{ $icon := "ban" }}
11
+
12
+
{{ if .Pull.State.IsOpen }}
13
+
{{ $bgColor = "bg-green-600 dark:bg-green-700" }}
14
+
{{ $icon = "git-pull-request" }}
15
+
{{ else if .Pull.State.IsMerged }}
16
+
{{ $bgColor = "bg-purple-600 dark:bg-purple-700" }}
17
+
{{ $icon = "git-merge" }}
18
+
{{ end }}
19
+
20
+
<section class="mt-2">
21
+
<div class="flex items-center gap-2">
22
+
<div
23
+
id="state"
24
+
class="inline-flex items-center rounded px-3 py-1 {{ $bgColor }}"
25
+
>
26
+
{{ i $icon "w-4 h-4 mr-1.5 text-white" }}
27
+
<span class="text-white">{{ .Pull.State.String }}</span>
28
+
</div>
29
+
<span class="text-gray-500 dark:text-gray-400 text-sm">
30
+
opened by
31
+
{{ $owner := index $.DidHandleMap .Pull.OwnerDid }}
32
+
<a href="/{{ $owner }}" class="no-underline hover:underline"
33
+
>{{ $owner }}</a
34
+
>
35
+
<span class="select-none before:content-['\00B7']"></span>
36
+
<time>{{ .Pull.Created | timeFmt }}</time>
37
+
<span class="select-none before:content-['\00B7']"></span>
38
+
<span>
39
+
targeting
40
+
<span class="text-xs rounded bg-gray-100 dark:bg-gray-700 text-black dark:text-white font-mono px-2 mx-1/2 inline-flex items-center">
41
+
<a href="/{{ .RepoInfo.FullName }}/tree/{{ .Pull.TargetBranch }}" class="no-underline hover:underline">{{ .Pull.TargetBranch }}</a>
42
+
</span>
43
+
</span>
44
+
{{ if not .Pull.IsPatchBased }}
45
+
<span>from
46
+
{{ if not .Pull.IsBranchBased }}
47
+
<a href="/{{ $owner }}/{{ .PullSourceRepo.Name }}" class="no-underline hover:underline">{{ $owner }}/{{ .PullSourceRepo.Name }}</a>
48
+
{{ end }}
49
+
50
+
{{ $fullRepo := .RepoInfo.FullName }}
51
+
{{ if not .Pull.IsBranchBased }}
52
+
{{ $fullRepo = printf "%s/%s" $owner .PullSourceRepo.Name }}
53
+
{{ end }}
54
+
<span class="text-xs rounded bg-gray-100 dark:bg-gray-700 text-black dark:text-white font-mono px-2 mx-1/2 inline-flex items-center">
55
+
<a href="/{{ $fullRepo }}/tree/{{ .Pull.PullSource.Branch }}" class="no-underline hover:underline">{{ .Pull.PullSource.Branch }}</a>
56
+
</span>
57
+
</span>
58
+
{{ end }}
59
+
</span>
60
+
</div>
61
+
62
+
{{ if .Pull.Body }}
63
+
<article id="body" class="mt-8 prose dark:prose-invert">
64
+
{{ .Pull.Body | markdown }}
65
+
</article>
66
+
{{ end }}
67
+
</section>
68
+
69
+
70
+
{{ end }}
+21
-71
appview/pages/templates/repo/pulls/patch.html
+21
-71
appview/pages/templates/repo/pulls/patch.html
···
3
3
{{ end }}
4
4
5
5
{{ define "content" }}
6
-
{{ $stat := .Diff.Stat }}
7
-
<div class="rounded drop-shadow-sm bg-white dark:bg-gray-800 py-4 px-6 dark:text-white">
8
-
<header class="pb-2">
9
-
<div class="flex gap-3 items-center mb-3">
10
-
<a href="/{{ .RepoInfo.FullName }}/pulls/{{ .Pull.PullId }}/" class="flex items-center gap-2 font-medium">
11
-
{{ i "arrow-left" "w-5 h-5" }}
12
-
back
13
-
</a>
14
-
<span class="select-none before:content-['\00B7']"></span>
15
-
round #{{ .Round }}
16
-
<span class="select-none before:content-['\00B7']"></span>
17
-
<a href="/{{ .RepoInfo.FullName }}/pulls/{{ .Pull.PullId }}/round/{{ .Round }}.patch">
18
-
view raw
19
-
</a>
20
-
</div>
21
-
<div class="border-t border-gray-200 dark:border-gray-700 my-2"></div>
22
-
<h1 class="text-2xl mt-3">
23
-
{{ .Pull.Title }}
24
-
<span class="text-gray-500 dark:text-gray-400">#{{ .Pull.PullId }}</span>
25
-
</h1>
26
-
</header>
27
-
28
-
{{ $bgColor := "bg-gray-800" }}
29
-
{{ $icon := "ban" }}
30
-
31
-
{{ if .Pull.State.IsOpen }}
32
-
{{ $bgColor = "bg-green-600" }}
33
-
{{ $icon = "git-pull-request" }}
34
-
{{ else if .Pull.State.IsMerged }}
35
-
{{ $bgColor = "bg-purple-600" }}
36
-
{{ $icon = "git-merge" }}
37
-
{{ end }}
38
-
39
-
<section>
40
-
<div class="flex items-center gap-2">
41
-
<div
42
-
id="state"
43
-
class="inline-flex items-center rounded px-3 py-1 {{ $bgColor }}"
44
-
>
45
-
{{ i $icon "w-4 h-4 mr-1.5 text-white" }}
46
-
<span class="text-white">{{ .Pull.State.String }}</span>
47
-
</div>
48
-
<span class="text-gray-500 dark:text-gray-400 text-sm">
49
-
opened by
50
-
{{ $owner := index $.DidHandleMap .Pull.OwnerDid }}
51
-
<a href="/{{ $owner }}" class="no-underline hover:underline"
52
-
>{{ $owner }}</a
53
-
>
54
-
<span class="select-none before:content-['\00B7']"></span>
55
-
<time>{{ .Pull.Created | timeFmt }}</time>
56
-
<span class="select-none before:content-['\00B7']"></span>
57
-
<span>targeting branch
58
-
<span class="text-xs rounded bg-gray-100 dark:bg-gray-700 text-black dark:text-white font-mono px-2 mx-1/2 inline-flex items-center">
59
-
{{ .Pull.TargetBranch }}
60
-
</span>
61
-
</span>
62
-
</span>
63
-
</div>
64
-
65
-
{{ if .Pull.Body }}
66
-
<article id="body" class="mt-2 prose dark:prose-invert">
67
-
{{ .Pull.Body | markdown }}
68
-
</article>
69
-
{{ end }}
70
-
</section>
71
-
72
-
</div>
73
-
74
-
<section>
75
-
{{ template "repo/fragments/diff" (list .RepoInfo.FullName .Diff) }}
76
-
</section>
6
+
<section>
7
+
<section
8
+
class="bg-white dark:bg-gray-800 p-6 rounded relative z-20 w-full mx-auto drop-shadow-sm dark:text-white"
9
+
>
10
+
<div class="flex gap-3 items-center mb-3">
11
+
<a href="/{{ .RepoInfo.FullName }}/pulls/{{ .Pull.PullId }}/" class="flex items-center gap-2 font-medium">
12
+
{{ i "arrow-left" "w-5 h-5" }}
13
+
back
14
+
</a>
15
+
<span class="select-none before:content-['\00B7']"></span>
16
+
round<span class="flex items-center">{{ i "hash" "w-4 h-4" }}{{ .Round }}</span>
17
+
<span class="select-none before:content-['\00B7']"></span>
18
+
<a href="/{{ .RepoInfo.FullName }}/pulls/{{ .Pull.PullId }}/round/{{ .Round }}.patch">
19
+
view raw
20
+
</a>
21
+
</div>
22
+
<div class="border-t border-gray-200 dark:border-gray-700 my-2"></div>
23
+
{{ template "repo/pulls/fragments/pullHeader" . }}
24
+
</section>
25
+
{{ template "repo/fragments/diff" (list .RepoInfo.FullName .Diff) }}
26
+
</section>
77
27
{{ end }}
+53
-79
appview/pages/templates/repo/pulls/pull.html
+53
-79
appview/pages/templates/repo/pulls/pull.html
···
3
3
{{ end }}
4
4
5
5
{{ define "repoContent" }}
6
-
<header class="pb-4">
7
-
<h1 class="text-2xl dark:text-white">
8
-
{{ .Pull.Title }}
9
-
<span class="text-gray-500 dark:text-gray-400">#{{ .Pull.PullId }}</span>
10
-
</h1>
11
-
</header>
12
-
13
-
{{ $bgColor := "bg-gray-800 dark:bg-gray-700" }}
14
-
{{ $icon := "ban" }}
15
-
16
-
{{ if .Pull.State.IsOpen }}
17
-
{{ $bgColor = "bg-green-600 dark:bg-green-700" }}
18
-
{{ $icon = "git-pull-request" }}
19
-
{{ else if .Pull.State.IsMerged }}
20
-
{{ $bgColor = "bg-purple-600 dark:bg-purple-700" }}
21
-
{{ $icon = "git-merge" }}
22
-
{{ end }}
23
-
24
-
<section class="mt-2">
25
-
<div class="flex items-center gap-2">
26
-
<div
27
-
id="state"
28
-
class="inline-flex items-center rounded px-3 py-1 {{ $bgColor }}"
29
-
>
30
-
{{ i $icon "w-4 h-4 mr-1.5 text-white" }}
31
-
<span class="text-white">{{ .Pull.State.String }}</span>
32
-
</div>
33
-
<span class="text-gray-500 dark:text-gray-400 text-sm">
34
-
opened by
35
-
{{ $owner := index $.DidHandleMap .Pull.OwnerDid }}
36
-
<a href="/{{ $owner }}" class="no-underline hover:underline"
37
-
>{{ $owner }}</a
38
-
>
39
-
<span class="select-none before:content-['\00B7']"></span>
40
-
<time>{{ .Pull.Created | timeFmt }}</time>
41
-
<span class="select-none before:content-['\00B7']"></span>
42
-
<span>
43
-
targeting
44
-
<span class="text-xs rounded bg-gray-100 dark:bg-gray-700 text-black dark:text-white font-mono px-2 mx-1/2 inline-flex items-center">
45
-
<a href="/{{ .RepoInfo.FullName }}/tree/{{ .Pull.TargetBranch }}" class="no-underline hover:underline">{{ .Pull.TargetBranch }}</a>
46
-
</span>
47
-
</span>
48
-
{{ if not .Pull.IsPatchBased }}
49
-
<span>from
50
-
{{ if not .Pull.IsBranchBased }}
51
-
<a href="/{{ $owner }}/{{ .PullSourceRepo.Name }}" class="no-underline hover:underline">{{ $owner }}/{{ .PullSourceRepo.Name }}</a>
52
-
{{ end }}
6
+
{{ template "repo/pulls/fragments/pullHeader" . }}
7
+
{{ end }}
53
8
54
-
{{ $fullRepo := .RepoInfo.FullName }}
55
-
{{ if not .Pull.IsBranchBased }}
56
-
{{ $fullRepo = printf "%s/%s" $owner .PullSourceRepo.Name }}
57
-
{{ end }}
58
-
<span class="text-xs rounded bg-gray-100 dark:bg-gray-700 text-black dark:text-white font-mono px-2 mx-1/2 inline-flex items-center">
59
-
<a href="/{{ $fullRepo }}/tree/{{ .Pull.PullSource.Branch }}" class="no-underline hover:underline">{{ .Pull.PullSource.Branch }}</a>
60
-
</span>
61
-
</span>
62
-
{{ end }}
63
-
</span>
64
-
</div>
65
9
66
-
{{ if .Pull.Body }}
67
-
<article id="body" class="mt-8 prose dark:prose-invert">
68
-
{{ .Pull.Body | markdown }}
69
-
</article>
70
-
{{ end }}
71
-
</section>
72
-
73
-
{{ end }}
74
10
75
11
{{ define "repoAfter" }}
76
12
<section id="submissions" class="mt-4">
···
88
24
{{ $targetBranch := .Pull.TargetBranch }}
89
25
{{ $repoName := .RepoInfo.FullName }}
90
26
{{ range $idx, $item := .Pull.Submissions }}
91
-
{{ $diff := $item.AsNiceDiff $targetBranch }}
92
27
{{ with $item }}
93
28
<details {{ if eq $idx $lastIdx }}open{{ end }}>
94
29
<summary id="round-#{{ .RoundNumber }}" class="list-none cursor-pointer">
95
30
<div class="flex flex-wrap gap-2 items-center">
96
31
<!-- round number -->
97
32
<div class="rounded bg-white dark:bg-gray-800 drop-shadow-sm px-3 py-2 dark:text-white">
98
-
#{{ .RoundNumber }}
33
+
<span class="flex items-center">{{ i "hash" "w-4 h-4" }}{{ .RoundNumber }}</span>
99
34
</div>
100
35
<!-- round summary -->
101
36
<div class="rounded drop-shadow-sm bg-white dark:bg-gray-800 p-2 text-gray-500 dark:text-gray-400">
···
117
52
{{ len .Comments }} comment{{$s}}
118
53
</span>
119
54
</div>
55
+
56
+
{{ if $.Pull.IsPatchBased }}
120
57
<!-- view patch -->
121
58
<a class="btn flex items-center gap-2 no-underline hover:no-underline p-2"
122
59
hx-boost="true"
123
60
href="/{{ $.RepoInfo.FullName }}/pulls/{{ $.Pull.PullId }}/round/{{.RoundNumber}}">
124
61
{{ i "file-diff" "w-4 h-4" }} <span class="hidden md:inline">view patch</span>
125
62
</a>
63
+
{{ end }}
126
64
</div>
127
65
</summary>
66
+
67
+
{{ if .IsFormatPatch }}
68
+
<div class="rounded ml-12 drop-shadow-sm bg-white dark:bg-gray-800 dark:text-white w-fit md:max-w-3/5 flex flex-col gap-2 mt-2 relative">
69
+
{{ $patches := .AsFormatPatch }}
70
+
{{ range $patches }}
71
+
<div id="commit-{{.SHA}}" class="py-2 px-4 relative w-full md:max-w-3/5 md:w-fit flex flex-col">
72
+
<div class="flex items-center justify-between gap-2">
73
+
{{ i "git-commit-horizontal" "w-4 h-4 mr-1.5" }}
74
+
<span>{{ .Title }}</span>
75
+
{{ if gt (len .Body) 0 }}
76
+
<button
77
+
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"
78
+
hx-on:click="document.getElementById('body-{{.SHA}}').classList.toggle('hidden')"
79
+
>
80
+
{{ i "ellipsis" "w-3 h-3" }}
81
+
</button>
82
+
{{ end }}
83
+
<div class="text-sm text-gray-500 dark:text-gray-400">
84
+
{{ if not $.Pull.IsPatchBased }}
85
+
{{ $fullRepo := $.RepoInfo.FullName }}
86
+
{{ if not $.Pull.IsBranchBased }}
87
+
{{ $fullRepo = printf "%s/%s" $owner $.PullSourceRepo.Name }}
88
+
{{ end }}
89
+
<a href="/{{ $fullRepo }}/commit/{{ .SHA }}" class="font-mono">{{ slice .SHA 0 8 }}</a>
90
+
{{ else }}
91
+
<span class="font-mono">{{ slice .SHA 0 8 }}</span>
92
+
{{ end }}
93
+
</div>
94
+
</div>
95
+
{{ if gt (len .Body) 0 }}
96
+
<p id="body-{{.SHA}}" class="hidden mt-1 text-sm pb-2 dark:text-gray-300">
97
+
{{ nl2br .Body }}
98
+
</p>
99
+
{{ end }}
100
+
</div>
101
+
{{ end }}
102
+
</div>
103
+
{{ end }}
104
+
105
+
128
106
<div class="md:pl-12 flex flex-col gap-2 mt-2 relative">
129
-
{{ range .Comments }}
130
-
<div id="comment-{{.ID}}" class="bg-white dark:bg-gray-800 rounded drop-shadow-sm py-2 px-4 relative w-full md:max-w-3/5 md:w-fit">
107
+
{{ range $cidx, $c := .Comments }}
108
+
<div id="comment-{{$c.ID}}" class="bg-white dark:bg-gray-800 rounded drop-shadow-sm py-2 px-4 relative w-full md:max-w-3/5 md:w-fit">
109
+
{{ if gt $cidx 0 }}
131
110
<div class="absolute left-8 -top-2 w-px h-2 bg-gray-300 dark:bg-gray-600"></div>
111
+
{{ end }}
132
112
<div class="text-sm text-gray-500 dark:text-gray-400">
133
-
{{ $owner := index $.DidHandleMap .OwnerDid }}
113
+
{{ $owner := index $.DidHandleMap $c.OwnerDid }}
134
114
<a href="/{{$owner}}">{{$owner}}</a>
135
115
<span class="before:content-['·']"></span>
136
-
<a class="text-gray-500 dark:text-gray-400 hover:text-gray-500 dark:hover:text-gray-300" href="#comment-{{.ID}}"><time>{{ .Created | shortTimeFmt }}</time></a>
116
+
<a class="text-gray-500 dark:text-gray-400 hover:text-gray-500 dark:hover:text-gray-300" href="#comment-{{.ID}}"><time>{{ $c.Created | shortTimeFmt }}</time></a>
137
117
</div>
138
118
<div class="prose dark:prose-invert">
139
-
{{ .Body | markdown }}
119
+
{{ $c.Body | markdown }}
140
120
</div>
141
121
</div>
142
122
{{ end }}
···
164
144
{{ define "mergeStatus" }}
165
145
{{ if .Pull.State.IsClosed }}
166
146
<div class="bg-gray-50 dark:bg-gray-700 border border-black dark:border-gray-500 rounded drop-shadow-sm px-6 py-2 relative w-fit">
167
-
<div class="absolute left-8 -top-2 w-px h-2 bg-gray-300 dark:bg-gray-600"></div>
168
147
<div class="flex items-center gap-2 text-black dark:text-white">
169
148
{{ i "ban" "w-4 h-4" }}
170
149
<span class="font-medium">closed without merging</span
···
173
152
</div>
174
153
{{ else if .Pull.State.IsMerged }}
175
154
<div class="bg-purple-50 dark:bg-purple-900 border border-purple-500 rounded drop-shadow-sm px-6 py-2 relative w-fit">
176
-
<div class="absolute left-8 -top-2 w-px h-2 bg-gray-300 dark:bg-gray-600"></div>
177
155
<div class="flex items-center gap-2 text-purple-500 dark:text-purple-300">
178
156
{{ i "git-merge" "w-4 h-4" }}
179
157
<span class="font-medium">pull request successfully merged</span
···
182
160
</div>
183
161
{{ else if and .MergeCheck .MergeCheck.Error }}
184
162
<div class="bg-red-50 dark:bg-red-900 border border-red-500 rounded drop-shadow-sm px-6 py-2 relative w-fit">
185
-
<div class="absolute left-8 -top-2 w-px h-2 bg-gray-300 dark:bg-gray-600"></div>
186
163
<div class="flex items-center gap-2 text-red-500 dark:text-red-300">
187
164
{{ i "triangle-alert" "w-4 h-4" }}
188
165
<span class="font-medium">{{ .MergeCheck.Error }}</span>
···
190
167
</div>
191
168
{{ else if and .MergeCheck .MergeCheck.IsConflicted }}
192
169
<div class="bg-red-50 dark:bg-red-900 border border-red-500 rounded drop-shadow-sm px-6 py-2 relative w-fit">
193
-
<div class="absolute left-8 -top-2 w-px h-2 bg-gray-300 dark:bg-gray-600"></div>
194
170
<div class="flex flex-col gap-2 text-red-500 dark:text-red-300">
195
171
<div class="flex items-center gap-2">
196
172
{{ i "triangle-alert" "w-4 h-4" }}
···
210
186
</div>
211
187
{{ else if .MergeCheck }}
212
188
<div class="bg-green-50 dark:bg-green-900 border border-green-500 rounded drop-shadow-sm px-6 py-2 relative w-fit">
213
-
<div class="absolute left-8 -top-2 w-px h-2 bg-gray-300 dark:bg-gray-600"></div>
214
189
<div class="flex items-center gap-2 text-green-500 dark:text-green-300">
215
190
{{ i "circle-check-big" "w-4 h-4" }}
216
191
<span class="font-medium">no conflicts, ready to merge</span>
···
222
197
{{ define "resubmitStatus" }}
223
198
{{ if .ResubmitCheck.Yes }}
224
199
<div class="bg-amber-50 dark:bg-amber-900 border border-amber-500 rounded drop-shadow-sm px-6 py-2 relative w-fit">
225
-
<div class="absolute left-8 -top-2 w-px h-2 bg-gray-300 dark:bg-gray-600"></div>
226
200
<div class="flex items-center gap-2 text-amber-500 dark:text-amber-300">
227
201
{{ i "triangle-alert" "w-4 h-4" }}
228
202
<span class="font-medium">this branch has been updated, consider resubmitting</span>