···
69
-
{{ $isPullAuthor := and .LoggedInUser (eq .LoggedInUser.Did .Pull.OwnerDid) }}
70
-
{{ $isPushAllowed := .RepoInfo.Roles.IsPushAllowed }}
72
-
{{ if and $isPullAuthor (not .Pull.State.IsMerged) }}
73
-
<section id="update-card" class="mt-8 space-y-4 relative">
74
-
{{ block "resubmitCard" . }} {{ end }}
78
-
<section id="merge-card" class="mt-8 space-y-4 relative">
79
-
{{ if .Pull.State.IsMerged }}
80
-
{{ block "alreadyMergedCard" . }} {{ end }}
81
-
{{ else if .MergeCheck }}
82
-
{{ if .MergeCheck.IsConflicted }}
83
-
{{ block "isConflictedCard" $ }} {{ end }}
85
-
{{ block "noConflictsCard" $ }} {{ end }}
<div id="pull-close"></div>
<div id="pull-reopen"></div>
···
{{ $oneIndexedRound := add .RoundNumber 1 }}
<details {{ if eq $idx $lastIdx }}open{{ end }}>
103
-
<summary id="round-#{{ $oneIndexedRound }}" class="list-none cursor-pointer text-sm">
82
+
<summary id="round-#{{ $oneIndexedRound }}" class="list-none cursor-pointer">
<div class="flex gap-2 items-center">
<div class="rounded bg-white drop-shadow-sm p-3">
···
{{ $owner := index $.DidHandleMap $.Pull.OwnerDid }}
submitted by <a href="/{{ $owner }}">{{ $owner }}</a>
<span class="select-none before:content-['\00B7']"></span>
113
-
<a href="#round-#{{ $oneIndexedRound }}"><time>{{ .Created | timeFmt }}</time></a>
92
+
<a class="text-gray-500 hover:text-gray-500" href="#round-#{{ $oneIndexedRound }}"><time>{{ .Created | timeFmt }}</time></a>
<span class="select-none before:content-['·']"></span>
{{ if eq (len .Comments) 1 }}
···
141
-
{{ block "newComment" (list $ .ID) }} {{ end }}
121
+
{{ block "mergeStatus" $ }} {{ end }}
123
+
{{ if $.LoggedInUser }}
124
+
{{ block "actions" (list $ .ID) }} {{ end }}
126
+
<div class="bg-white rounded drop-shadow-sm px-6 py-4 w-fit">
127
+
<div class="absolute left-8 -top-2 w-px h-2 bg-gray-300"></div>
128
+
<a href="/login" class="underline">login</a> to join the discussion
137
+
{{ define "mergeStatus" }}
138
+
{{ if .Pull.State.IsMerged }}
139
+
<div class="bg-purple-50 border border-purple-500 rounded drop-shadow-sm px-6 py-2 relative w-fit">
140
+
<div class="absolute left-8 -top-2 w-px h-2 bg-gray-300"></div>
141
+
<div class="flex items-center gap-2 text-purple-500">
142
+
<i data-lucide="git-merge" class="w-4 h-4"></i>
143
+
<span class="font-medium">pull request successfully merged</span
147
+
{{ else if and .MergeCheck .MergeCheck.IsConflicted }}
148
+
<div class="bg-red-50 border border-red-500 rounded drop-shadow-sm px-6 py-2 relative w-fit">
149
+
<div class="absolute left-8 -top-2 w-px h-2 bg-gray-300"></div>
150
+
<div class="flex items-center gap-2 text-red-500">
151
+
<i data-lucide="alert-triangle" class="w-4 h-4"></i>
152
+
<span class="font-medium">merge conflicts detected</span>
153
+
<ul class="text-sm space-y-1">
154
+
{{ range .MergeCheck.Conflicts }}
156
+
<li class="flex items-center">
158
+
data-lucide="file-warning"
159
+
class="w-3 h-3 mr-1.5 text-red-500"
161
+
<span class="font-mono">{{ slice .Filename 0 (sub (len .Filename) 2) }}</span>
168
+
{{ else if .MergeCheck }}
169
+
<div class="bg-green-50 border border-green-500 rounded drop-shadow-sm px-6 py-2 relative w-fit">
170
+
<div class="absolute left-8 -top-2 w-px h-2 bg-gray-300"></div>
171
+
<div class="flex items-center gap-2 text-green-500">
172
+
<i data-lucide="check-circle" class="w-4 h-4"></i>
173
+
<span class="font-medium">no conflicts, ready to merge</span>
179
+
{{ define "actions" }}
180
+
{{ $rootObj := index . 0 }}
181
+
{{ $submissionId := index . 1 }}
183
+
{{ with $rootObj }}
184
+
{{ $isPushAllowed := .RepoInfo.Roles.IsPushAllowed }}
185
+
{{ $isMerged := .Pull.State.IsMerged }}
186
+
{{ $isClosed := .Pull.State.IsClosed }}
187
+
{{ $isOpen := .Pull.State.IsOpen }}
188
+
{{ $isConflicted := and .MergeCheck .MergeCheck.IsConflicted }}
189
+
{{ $isPullAuthor := and .LoggedInUser (eq .LoggedInUser.Did .Pull.OwnerDid) }}
190
+
<div class="relative w-fit">
191
+
<div class="absolute left-8 -top-2 w-px h-2 bg-gray-300"></div>
192
+
<div class="flex flex-wrap gap-2">
193
+
<button href="#" class="btn p-2 flex items-center gap-2 no-underline hover:no-underline">
194
+
<i data-lucide="message-square-plus" class="w-4 h-4"></i>
195
+
<span>comment</span>
197
+
{{ if and $isPushAllowed $isOpen }}
198
+
{{ $disabled := "" }}
199
+
{{ if $isConflicted }}
200
+
{{ $disabled = "disabled" }}
202
+
<button href="#" class="btn p-2 flex items-center gap-2 no-underline hover:no-underline" {{ $disabled }}>
203
+
<i data-lucide="git-merge" class="w-4 h-4"></i>
208
+
{{ if and $isPullAuthor $isOpen }}
209
+
<button href="#" class="btn p-2 flex items-center gap-2 no-underline hover:no-underline">
210
+
<i data-lucide="rotate-ccw" class="w-4 h-4"></i>
211
+
<span>resubmit</span>
215
+
{{ if and $isPullAuthor $isPushAllowed $isOpen }}
216
+
<button href="#" class="btn p-2 flex items-center gap-2 no-underline hover:no-underline">
217
+
<i data-lucide="ban" class="w-4 h-4"></i>
222
+
{{ if and $isPullAuthor $isPushAllowed $isClosed }}
223
+
<button href="#" class="btn p-2 flex items-center gap-2 no-underline hover:no-underline">
224
+
<i data-lucide="circle-dot" class="w-4 h-4"></i>
225
+
<span>reopen</span>