Mirror of @tangled.org/core. Running on a Raspberry Pi Zero 2 (Please be gentle).

move actions closer to the submission round

+111 -25
+109 -25
appview/pages/templates/repo/pulls/pull.html
··· 66 66 </div> 67 67 </section> 68 68 69 - {{ $isPullAuthor := and .LoggedInUser (eq .LoggedInUser.Did .Pull.OwnerDid) }} 70 - {{ $isPushAllowed := .RepoInfo.Roles.IsPushAllowed }} 71 - 72 - {{ if and $isPullAuthor (not .Pull.State.IsMerged) }} 73 - <section id="update-card" class="mt-8 space-y-4 relative"> 74 - {{ block "resubmitCard" . }} {{ end }} 75 - </section> 76 - {{ end }} 77 - 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 }} 84 - {{ else }} 85 - {{ block "noConflictsCard" $ }} {{ end }} 86 - {{ end }} 87 - {{ end }} 88 - </section> 89 - 90 69 <div id="pull-close"></div> 91 70 <div id="pull-reopen"></div> 92 71 {{ end }} ··· 79 100 {{ with $item }} 80 101 {{ $oneIndexedRound := add .RoundNumber 1 }} 81 102 <details {{ if eq $idx $lastIdx }}open{{ end }}> 82 - <summary id="round-#{{ $oneIndexedRound }}" class="list-none cursor-pointer text-sm"> 103 + <summary id="round-#{{ $oneIndexedRound }}" class="list-none cursor-pointer"> 83 104 <div class="flex gap-2 items-center"> 84 105 <div class="rounded bg-white drop-shadow-sm p-3"> 85 106 #{{ $oneIndexedRound }} ··· 89 110 {{ $owner := index $.DidHandleMap $.Pull.OwnerDid }} 90 111 submitted by <a href="/{{ $owner }}">{{ $owner }}</a> 91 112 <span class="select-none before:content-['\00B7']"></span> 92 - <a href="#round-#{{ $oneIndexedRound }}"><time>{{ .Created | timeFmt }}</time></a> 113 + <a class="text-gray-500 hover:text-gray-500" href="#round-#{{ $oneIndexedRound }}"><time>{{ .Created | timeFmt }}</time></a> 93 114 <span class="select-none before:content-['·']"></span> 94 115 {{ $s := "s" }} 95 116 {{ if eq (len .Comments) 1 }} ··· 117 138 </div> 118 139 </div> 119 140 {{ end }} 120 - {{ block "newComment" (list $ .ID) }} {{ end }} 141 + 142 + {{ block "mergeStatus" $ }} {{ end }} 143 + 144 + {{ if $.LoggedInUser }} 145 + {{ block "actions" (list $ .ID) }} {{ end }} 146 + {{ else }} 147 + <div class="bg-white rounded drop-shadow-sm px-6 py-4 w-fit"> 148 + <div class="absolute left-8 -top-2 w-px h-2 bg-gray-300"></div> 149 + <a href="/login" class="underline">login</a> to join the discussion 150 + </div> 151 + {{ end }} 121 152 </div> 122 153 </details> 123 - <hr /> 124 154 {{ end }} 155 + {{ end }} 156 + {{ end }} 157 + 158 + {{ define "mergeStatus" }} 159 + {{ if .Pull.State.IsMerged }} 160 + <div class="bg-purple-50 border border-purple-500 rounded drop-shadow-sm px-6 py-2 relative w-fit"> 161 + <div class="absolute left-8 -top-2 w-px h-2 bg-gray-300"></div> 162 + <div class="flex items-center gap-2 text-purple-500"> 163 + <i data-lucide="git-merge" class="w-4 h-4"></i> 164 + <span class="font-medium">pull request successfully merged</span 165 + > 166 + </div> 167 + </div> 168 + {{ else if and .MergeCheck .MergeCheck.IsConflicted }} 169 + <div class="bg-red-50 border border-red-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-red-500"> 172 + <i data-lucide="alert-triangle" class="w-4 h-4"></i> 173 + <span class="font-medium">merge conflicts detected</span> 174 + <ul class="text-sm space-y-1"> 175 + {{ range .MergeCheck.Conflicts }} 176 + {{ if .Filename }} 177 + <li class="flex items-center"> 178 + <i 179 + data-lucide="file-warning" 180 + class="w-3 h-3 mr-1.5 text-red-500" 181 + ></i> 182 + <span class="font-mono">{{ slice .Filename 0 (sub (len .Filename) 2) }}</span> 183 + </li> 184 + {{ end }} 185 + {{ end }} 186 + </ul> 187 + </div> 188 + </div> 189 + {{ else if .MergeCheck }} 190 + <div class="bg-green-50 border border-green-500 rounded drop-shadow-sm px-6 py-2 relative w-fit"> 191 + <div class="absolute left-8 -top-2 w-px h-2 bg-gray-300"></div> 192 + <div class="flex items-center gap-2 text-green-500"> 193 + <i data-lucide="check-circle" class="w-4 h-4"></i> 194 + <span class="font-medium">no conflicts, ready to merge</span> 195 + </div> 196 + </div> 197 + {{ end }} 198 + {{ end }} 199 + 200 + {{ define "actions" }} 201 + {{ $rootObj := index . 0 }} 202 + {{ $submissionId := index . 1 }} 203 + 204 + {{ with $rootObj }} 205 + {{ $isPushAllowed := .RepoInfo.Roles.IsPushAllowed }} 206 + {{ $isMerged := .Pull.State.IsMerged }} 207 + {{ $isClosed := .Pull.State.IsClosed }} 208 + {{ $isOpen := .Pull.State.IsOpen }} 209 + {{ $isConflicted := and .MergeCheck .MergeCheck.IsConflicted }} 210 + {{ $isPullAuthor := and .LoggedInUser (eq .LoggedInUser.Did .Pull.OwnerDid) }} 211 + <div class="relative w-fit"> 212 + <div class="absolute left-8 -top-2 w-px h-2 bg-gray-300"></div> 213 + <div class="flex flex-wrap gap-2"> 214 + <button href="#" class="btn p-2 flex items-center gap-2 no-underline hover:no-underline"> 215 + <i data-lucide="message-square-plus" class="w-4 h-4"></i> 216 + <span>comment</span> 217 + </button> 218 + {{ if and $isPushAllowed $isOpen }} 219 + {{ $disabled := "" }} 220 + {{ if $isConflicted }} 221 + {{ $disabled = "disabled" }} 222 + {{ end }} 223 + <button href="#" class="btn p-2 flex items-center gap-2 no-underline hover:no-underline" {{ $disabled }}> 224 + <i data-lucide="git-merge" class="w-4 h-4"></i> 225 + <span>merge</span> 226 + </button> 227 + {{ end }} 228 + 229 + {{ if and $isPullAuthor $isOpen }} 230 + <button href="#" class="btn p-2 flex items-center gap-2 no-underline hover:no-underline"> 231 + <i data-lucide="rotate-ccw" class="w-4 h-4"></i> 232 + <span>resubmit</span> 233 + </button> 234 + {{ end }} 235 + 236 + {{ if and $isPullAuthor $isPushAllowed $isOpen }} 237 + <button href="#" class="btn p-2 flex items-center gap-2 no-underline hover:no-underline"> 238 + <i data-lucide="ban" class="w-4 h-4"></i> 239 + <span>close</span> 240 + </button> 241 + {{ end }} 242 + 243 + {{ if and $isPullAuthor $isPushAllowed $isClosed }} 244 + <button href="#" class="btn p-2 flex items-center gap-2 no-underline hover:no-underline"> 245 + <i data-lucide="circle-dot" class="w-4 h-4"></i> 246 + <span>reopen</span> 247 + </button> 248 + {{ end }} 249 + </div> 250 + </div> 125 251 {{ end }} 126 252 {{ end }} 127 253
+2
appview/state/pull.go
··· 94 94 } 95 95 } 96 96 97 + log.Println(mergeCheckResponse) 98 + 97 99 s.pages.RepoSinglePull(w, pages.RepoSinglePullParams{ 98 100 LoggedInUser: user, 99 101 RepoInfo: f.RepoInfo(s, user),