Monorepo for Tangled tangled.org

appview: show compare link next to recent branches

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

authored by oppi.li and committed by Tangled 079fbc1d 683bf2cf

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" ··· 294 294 </a> 295 295 <div class="flex flex-col gap-1"> 296 296 {{ range .BranchesTrunc }} 297 - <div class="text-base flex items-center gap-2"> 298 - <a href="/{{ $.RepoInfo.FullName }}/tree/{{ .Reference.Name | urlquery }}" 299 - class="inline no-underline hover:underline dark:text-white"> 300 - {{ .Reference.Name }} 301 - </a> 302 - {{ if .Commit }} 303 - <span class="px-1 text-gray-500 dark:text-gray-400 select-none after:content-['·']"></span> 304 - <time class="text-xs text-gray-500 dark:text-gray-400">{{ timeFmt .Commit.Committer.When }}</time> 305 - {{ end }} 306 - {{ if .IsDefault }} 307 - <span class="px-1 text-gray-500 dark:text-gray-400 select-none after:content-['·']"></span> 308 - <span class="bg-gray-200 dark:bg-gray-700 rounded py-1/2 px-1 text-xs font-mono">default</span> 309 - {{ end }} 297 + <div class="text-base flex items-center justify-between"> 298 + <div class="flex items-center gap-2"> 299 + <a href="/{{ $.RepoInfo.FullName }}/tree/{{ .Reference.Name | urlquery }}" 300 + class="inline no-underline hover:underline dark:text-white"> 301 + {{ .Reference.Name }} 302 + </a> 303 + {{ if .Commit }} 304 + <span class="px-1 text-gray-500 dark:text-gray-400 select-none after:content-['·']"></span> 305 + <time class="text-xs text-gray-500 dark:text-gray-400">{{ timeFmt .Commit.Committer.When }}</time> 306 + {{ end }} 307 + {{ if .IsDefault }} 308 + <span class="px-1 text-gray-500 dark:text-gray-400 select-none after:content-['·']"></span> 309 + <span class="bg-gray-200 dark:bg-gray-700 rounded py-1/2 px-1 text-xs font-mono">default</span> 310 + {{ end }} 311 + </div> 312 + {{ if ne $.Ref .Reference.Name }} 313 + <a href="/{{ $.RepoInfo.FullName }}/compare/{{ $.Ref | urlquery }}...{{ .Reference.Name | urlquery }}" 314 + class="text-xs flex gap-2 items-center" 315 + title="Compare branches or tags"> 316 + {{ i "git-compare" "w-3 h-3" }} compare 317 + </a> 318 + {{end}} 310 319 </div> 311 320 {{ end }} 312 321 </div> ··· 339 348 </div> 340 349 <div> 341 350 {{ with .Tag }} 342 - <time class="text-xs text-gray-500 dark:text-gray-400">{{ timeFmt .Tagger.When }}</time> 351 + <time class="text-xs text-gray-500 dark:text-gray-400">{{ timeFmt .Tagger.When }}</time> 343 352 {{ end }} 344 353 {{ if eq $idx 0 }} 345 - <span class="px-1 text-gray-500 dark:text-gray-400 select-none after:content-['·']"></span> 346 - <span class="bg-gray-200 dark:bg-gray-700 rounded py-1/2 px-1 text-xs font-mono">latest</span> 354 + {{ with .Tag }}<span class="px-1 text-gray-500 dark:text-gray-400 select-none after:content-['·']"></span>{{ end }} 355 + <span class="bg-gray-200 dark:bg-gray-700 rounded py-1/2 px-1 text-xs font-mono">latest</span> 347 356 {{ end }} 348 357 </div> 349 358 </div>
+1 -1
appview/repo/repo_util.go
··· 46 46 47 47 // clamp branchcount 48 48 if branchCount > 0 { 49 - branchesTrunc = min(max(branchCount, 1), 2) 49 + branchesTrunc = min(max(branchCount, 1), 3) 50 50 availableSpace -= branchesTrunc // an extra subtracted for headers etc. 51 51 } 52 52