Monorepo for Tangled tangled.org

appview: show compare link next to recent branches

Signed-off-by: oppiliappan <me@oppi.li>

Changed files
+27 -18
appview
pages
templates
repo
repo
+26 -17
appview/pages/templates/repo/index.html
··· 32 32 {{ end }} 33 33 34 34 {{ define "branchSelector" }} 35 - <div class="flex gap-4 items-center justify-center"> 35 + <div class="flex gap-2 items-center items-stretch justify-center"> 36 36 <select 37 37 onchange="window.location.href = '/{{ .RepoInfo.FullName }}/tree/' + encodeURIComponent(this.value)" 38 38 class="p-1 border max-w-32 border-gray-200 bg-white dark:bg-gray-800 dark:text-white dark:border-gray-700" ··· 286 286 </a> 287 287 <div class="flex flex-col gap-1"> 288 288 {{ range .BranchesTrunc }} 289 - <div class="text-base flex items-center gap-2"> 290 - <a href="/{{ $.RepoInfo.FullName }}/tree/{{ .Reference.Name | urlquery }}" 291 - class="inline no-underline hover:underline dark:text-white"> 292 - {{ .Reference.Name }} 293 - </a> 294 - {{ if .Commit }} 295 - <span class="px-1 text-gray-500 dark:text-gray-400 select-none after:content-['·']"></span> 296 - <time class="text-xs text-gray-500 dark:text-gray-400">{{ timeFmt .Commit.Committer.When }}</time> 297 - {{ end }} 298 - {{ if .IsDefault }} 299 - <span class="px-1 text-gray-500 dark:text-gray-400 select-none after:content-['·']"></span> 300 - <span class="bg-gray-200 dark:bg-gray-700 rounded py-1/2 px-1 text-xs font-mono">default</span> 301 - {{ end }} 289 + <div class="text-base flex items-center justify-between"> 290 + <div class="flex items-center gap-2"> 291 + <a href="/{{ $.RepoInfo.FullName }}/tree/{{ .Reference.Name | urlquery }}" 292 + class="inline no-underline hover:underline dark:text-white"> 293 + {{ .Reference.Name }} 294 + </a> 295 + {{ if .Commit }} 296 + <span class="px-1 text-gray-500 dark:text-gray-400 select-none after:content-['·']"></span> 297 + <time class="text-xs text-gray-500 dark:text-gray-400">{{ timeFmt .Commit.Committer.When }}</time> 298 + {{ end }} 299 + {{ if .IsDefault }} 300 + <span class="px-1 text-gray-500 dark:text-gray-400 select-none after:content-['·']"></span> 301 + <span class="bg-gray-200 dark:bg-gray-700 rounded py-1/2 px-1 text-xs font-mono">default</span> 302 + {{ end }} 303 + </div> 304 + {{ if ne $.Ref .Reference.Name }} 305 + <a href="/{{ $.RepoInfo.FullName }}/compare/{{ $.Ref | urlquery }}...{{ .Reference.Name | urlquery }}" 306 + class="text-xs flex gap-2 items-center" 307 + title="Compare branches or tags"> 308 + {{ i "git-compare" "w-3 h-3" }} compare 309 + </a> 310 + {{end}} 302 311 </div> 303 312 {{ end }} 304 313 </div> ··· 331 340 </div> 332 341 <div> 333 342 {{ with .Tag }} 334 - <time class="text-xs text-gray-500 dark:text-gray-400">{{ timeFmt .Tagger.When }}</time> 343 + <time class="text-xs text-gray-500 dark:text-gray-400">{{ timeFmt .Tagger.When }}</time> 335 344 {{ end }} 336 345 {{ if eq $idx 0 }} 337 - <span class="px-1 text-gray-500 dark:text-gray-400 select-none after:content-['·']"></span> 338 - <span class="bg-gray-200 dark:bg-gray-700 rounded py-1/2 px-1 text-xs font-mono">latest</span> 346 + {{ with .Tag }}<span class="px-1 text-gray-500 dark:text-gray-400 select-none after:content-['·']"></span>{{ end }} 347 + <span class="bg-gray-200 dark:bg-gray-700 rounded py-1/2 px-1 text-xs font-mono">latest</span> 339 348 {{ end }} 340 349 </div> 341 350 </div>
+1 -1
appview/repo/repo_util.go
··· 44 44 45 45 // clamp branchcount 46 46 if branchCount > 0 { 47 - branchesTrunc = min(max(branchCount, 1), 2) 47 + branchesTrunc = min(max(branchCount, 1), 3) 48 48 availableSpace -= branchesTrunc // an extra subtracted for headers etc. 49 49 } 50 50