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

Configure Feed

Select the types of activity you want to include in your feed.

appview: pages/templates/repo/pulls: dedupe pull header and display commits

authored by

Anirudh Oppiliappan and committed by
Akshay
cee3a69c f0f962e3

+145 -151
+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
··· 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 }}
+54 -80
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 }} 53 - 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 - 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 - 6 + {{ template "repo/pulls/fragments/pullHeader" . }} 73 7 {{ end }} 8 + 9 + 74 10 75 11 {{ define "repoAfter" }} 76 12 <section id="submissions" class="mt-4"> ··· 24 88 {{ $targetBranch := .Pull.TargetBranch }} 25 89 {{ $repoName := .RepoInfo.FullName }} 26 90 {{ range $idx, $item := .Pull.Submissions }} 27 - {{ $diff := $item.AsNiceDiff $targetBranch }} 28 91 {{ with $item }} 29 92 <details {{ if eq $idx $lastIdx }}open{{ end }}> 30 93 <summary id="round-#{{ .RoundNumber }}" class="list-none cursor-pointer"> 31 94 <div class="flex flex-wrap gap-2 items-center"> 32 95 <!-- round number --> 33 96 <div class="rounded bg-white dark:bg-gray-800 drop-shadow-sm px-3 py-2 dark:text-white"> 34 - #{{ .RoundNumber }} 97 + <span class="flex items-center">{{ i "hash" "w-4 h-4" }}{{ .RoundNumber }}</span> 35 98 </div> 36 99 <!-- round summary --> 37 100 <div class="rounded drop-shadow-sm bg-white dark:bg-gray-800 p-2 text-gray-500 dark:text-gray-400"> ··· 52 117 {{ len .Comments }} comment{{$s}} 53 118 </span> 54 119 </div> 120 + 121 + {{ if $.Pull.IsPatchBased }} 55 122 <!-- view patch --> 56 123 <a class="btn flex items-center gap-2 no-underline hover:no-underline p-2" 57 124 hx-boost="true" 58 125 href="/{{ $.RepoInfo.FullName }}/pulls/{{ $.Pull.PullId }}/round/{{.RoundNumber}}"> 59 126 {{ i "file-diff" "w-4 h-4" }} <span class="hidden md:inline">view patch</span> 60 127 </a> 128 + {{ end }} 61 129 </div> 62 130 </summary> 131 + 132 + {{ if .IsFormatPatch }} 133 + <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"> 134 + {{ $patches := .AsFormatPatch }} 135 + {{ range $patches }} 136 + <div id="commit-{{.SHA}}" class="py-2 px-4 relative w-full md:max-w-3/5 md:w-fit flex flex-col"> 137 + <div class="flex items-center justify-between gap-2"> 138 + {{ i "git-commit-horizontal" "w-4 h-4 mr-1.5" }} 139 + <span>{{ .Title }}</span> 140 + {{ if gt (len .Body) 0 }} 141 + <button 142 + 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" 143 + hx-on:click="document.getElementById('body-{{.SHA}}').classList.toggle('hidden')" 144 + > 145 + {{ i "ellipsis" "w-3 h-3" }} 146 + </button> 147 + {{ end }} 148 + <div class="text-sm text-gray-500 dark:text-gray-400"> 149 + {{ if not $.Pull.IsPatchBased }} 150 + {{ $fullRepo := $.RepoInfo.FullName }} 151 + {{ if not $.Pull.IsBranchBased }} 152 + {{ $fullRepo = printf "%s/%s" $owner $.PullSourceRepo.Name }} 153 + {{ end }} 154 + <a href="/{{ $fullRepo }}/commit/{{ .SHA }}" class="font-mono">{{ slice .SHA 0 8 }}</a> 155 + {{ else }} 156 + <span class="font-mono">{{ slice .SHA 0 8 }}</span> 157 + {{ end }} 158 + </div> 159 + </div> 160 + {{ if gt (len .Body) 0 }} 161 + <p id="body-{{.SHA}}" class="hidden mt-1 text-sm pb-2 dark:text-gray-300"> 162 + {{ nl2br .Body }} 163 + </p> 164 + {{ end }} 165 + </div> 166 + {{ end }} 167 + </div> 168 + {{ end }} 169 + 170 + 63 171 <div class="md:pl-12 flex flex-col gap-2 mt-2 relative"> 64 - {{ range .Comments }} 65 - <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"> 172 + {{ range $cidx, $c := .Comments }} 173 + <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"> 174 + {{ if gt $cidx 0 }} 66 175 <div class="absolute left-8 -top-2 w-px h-2 bg-gray-300 dark:bg-gray-600"></div> 176 + {{ end }} 67 177 <div class="text-sm text-gray-500 dark:text-gray-400"> 68 - {{ $owner := index $.DidHandleMap .OwnerDid }} 178 + {{ $owner := index $.DidHandleMap $c.OwnerDid }} 69 179 <a href="/{{$owner}}">{{$owner}}</a> 70 180 <span class="before:content-['·']"></span> 71 - <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> 181 + <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> 72 182 </div> 73 183 <div class="prose dark:prose-invert"> 74 - {{ .Body | markdown }} 184 + {{ $c.Body | markdown }} 75 185 </div> 76 186 </div> 77 187 {{ end }} ··· 144 164 {{ define "mergeStatus" }} 145 165 {{ if .Pull.State.IsClosed }} 146 166 <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"> 147 - <div class="absolute left-8 -top-2 w-px h-2 bg-gray-300 dark:bg-gray-600"></div> 148 167 <div class="flex items-center gap-2 text-black dark:text-white"> 149 168 {{ i "ban" "w-4 h-4" }} 150 169 <span class="font-medium">closed without merging</span ··· 152 173 </div> 153 174 {{ else if .Pull.State.IsMerged }} 154 175 <div class="bg-purple-50 dark:bg-purple-900 border border-purple-500 rounded drop-shadow-sm px-6 py-2 relative w-fit"> 155 - <div class="absolute left-8 -top-2 w-px h-2 bg-gray-300 dark:bg-gray-600"></div> 156 176 <div class="flex items-center gap-2 text-purple-500 dark:text-purple-300"> 157 177 {{ i "git-merge" "w-4 h-4" }} 158 178 <span class="font-medium">pull request successfully merged</span ··· 160 182 </div> 161 183 {{ else if and .MergeCheck .MergeCheck.Error }} 162 184 <div class="bg-red-50 dark:bg-red-900 border border-red-500 rounded drop-shadow-sm px-6 py-2 relative w-fit"> 163 - <div class="absolute left-8 -top-2 w-px h-2 bg-gray-300 dark:bg-gray-600"></div> 164 185 <div class="flex items-center gap-2 text-red-500 dark:text-red-300"> 165 186 {{ i "triangle-alert" "w-4 h-4" }} 166 187 <span class="font-medium">{{ .MergeCheck.Error }}</span> ··· 167 190 </div> 168 191 {{ else if and .MergeCheck .MergeCheck.IsConflicted }} 169 192 <div class="bg-red-50 dark:bg-red-900 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 dark:bg-gray-600"></div> 171 193 <div class="flex flex-col gap-2 text-red-500 dark:text-red-300"> 172 194 <div class="flex items-center gap-2"> 173 195 {{ i "triangle-alert" "w-4 h-4" }} ··· 186 210 </div> 187 211 {{ else if .MergeCheck }} 188 212 <div class="bg-green-50 dark:bg-green-900 border border-green-500 rounded drop-shadow-sm px-6 py-2 relative w-fit"> 189 - <div class="absolute left-8 -top-2 w-px h-2 bg-gray-300 dark:bg-gray-600"></div> 190 213 <div class="flex items-center gap-2 text-green-500 dark:text-green-300"> 191 214 {{ i "circle-check-big" "w-4 h-4" }} 192 215 <span class="font-medium">no conflicts, ready to merge</span> ··· 197 222 {{ define "resubmitStatus" }} 198 223 {{ if .ResubmitCheck.Yes }} 199 224 <div class="bg-amber-50 dark:bg-amber-900 border border-amber-500 rounded drop-shadow-sm px-6 py-2 relative w-fit"> 200 - <div class="absolute left-8 -top-2 w-px h-2 bg-gray-300 dark:bg-gray-600"></div> 201 225 <div class="flex items-center gap-2 text-amber-500 dark:text-amber-300"> 202 226 {{ i "triangle-alert" "w-4 h-4" }} 203 227 <span class="font-medium">this branch has been updated, consider resubmitting</span>