A vibe coded tangled fork which supports pijul.
at master 378 lines 16 kB view raw
1{{ define "title" }}{{ .RepoInfo.FullName }} at {{ .Ref }}{{ end }} 2 3 4{{ define "extrameta" }} 5 {{ template "repo/fragments/meta" . }} 6 7 {{ template "repo/fragments/og" (dict "RepoInfo" .RepoInfo) }} 8{{ end }} 9 10{{ define "repoContent" }} 11 <main> 12 {{ if .Languages }} 13 {{ block "repoLanguages" . }}{{ end }} 14 {{ end }} 15 <div class="flex items-center justify-between pb-5"> 16 {{ block "branchSelector" . }}{{ end }} 17 <div class="flex items-center gap-3"> 18 <a href="/{{ .RepoInfo.FullName }}/commits/{{ .Ref | urlquery }}" class="inline-flex md:hidden items-center text-sm gap-1 font-bold"> 19 {{ i "git-commit-horizontal" "w-4" "h-4" }} {{ .TotalCommits }} 20 </a> 21 <a href="/{{ .RepoInfo.FullName }}/{{ if .RepoInfo.IsPijul }}channels{{ else }}branches{{ end }}" class="inline-flex md:hidden items-center text-sm gap-1 font-bold"> 22 {{ i "git-branch" "w-4" "h-4" }} {{ len .Branches }} 23 </a> 24 {{ if not .RepoInfo.IsPijul }} 25 <a href="/{{ .RepoInfo.FullName }}/tags" class="inline-flex md:hidden items-center text-sm gap-1 font-bold"> 26 {{ i "tags" "w-4" "h-4" }} {{ len .Tags }} 27 </a> 28 {{ end }} 29 {{ template "repo/fragments/cloneDropdown" . }} 30 </div> 31 </div> 32 <div class="grid grid-cols-1 md:grid-cols-2 gap-2"> 33 {{ block "fileTree" . }}{{ end }} 34 {{ block "rightInfo" . }}{{ end }} 35 </div> 36 </main> 37{{ end }} 38 39{{ define "repoLanguages" }} 40 <details class="group -my-4 -m-6 mb-4"> 41 <summary class="flex gap-[1px] h-4 scale-y-50 hover:scale-y-100 origin-top group-open:scale-y-100 transition-all hover:cursor-pointer overflow-hidden rounded-t"> 42 {{ range $value := .Languages }} 43 <div 44 title='{{ or $value.Name "Other" }} {{ printf "%.1f" $value.Percentage }}%' 45 style="background-color: {{ $value.Color }}; width: {{ $value.Percentage }}%" 46 ></div> 47 {{ end }} 48 </summary> 49 <div class="px-4 py-2 border-b border-gray-200 dark:border-gray-600 flex items-center gap-4 flex-wrap"> 50 {{ range $value := .Languages }} 51 <div 52 class="flex items-center gap-2 text-xs align-items-center justify-center" 53 > 54 {{ template "repo/fragments/colorBall" (dict "color" (langColor $value.Name)) }} 55 <div>{{ or $value.Name "Other" }} 56 <span class="text-gray-500 dark:text-gray-400"> 57 {{ if lt $value.Percentage 0.05 }} 58 0.1% 59 {{ else }} 60 {{ printf "%.1f" $value.Percentage }}% 61 {{ end }} 62 </span></div> 63 </div> 64 {{ end }} 65 </div> 66 </details> 67{{ end }} 68 69{{ define "branchSelector" }} 70 <div class="flex gap-2 items-center justify-between w-full"> 71 <div class="flex gap-2 items-stretch"> 72 <select 73 onchange="window.location.href = '/{{ .RepoInfo.FullName }}/tree/' + encodeURIComponent(this.value)" 74 class="p-1 border max-w-32 border-gray-200 bg-white dark:bg-gray-800 dark:text-white dark:border-gray-700" 75 > 76 <optgroup label="{{ if .RepoInfo.IsPijul }}channels{{ else }}branches{{ end }} ({{len .Branches}})" class="bold text-sm"> 77 {{ range .Branches }} 78 <option 79 value="{{ .Reference.Name }}" 80 class="py-1" 81 {{ if eq .Reference.Name $.Ref }} 82 selected 83 {{ end }} 84 > 85 {{ .Reference.Name }} 86 </option> 87 {{ end }} 88 </optgroup> 89 {{ if not .RepoInfo.IsPijul }} 90 <optgroup label="tags ({{len .Tags}})" class="bold text-sm"> 91 {{ range .Tags }} 92 <option 93 value="{{ .Reference.Name }}" 94 class="py-1" 95 {{ if eq .Reference.Name $.Ref }} 96 selected 97 {{ end }} 98 > 99 {{ .Reference.Name }} 100 </option> 101 {{ else }} 102 <option class="py-1" disabled>no tags found</option> 103 {{ end }} 104 </optgroup> 105 {{ end }} 106 </select> 107 <div class="flex items-center gap-2"> 108 <a 109 href="/{{ .RepoInfo.FullName }}/compare?base={{ $.Ref | urlquery }}" 110 class="btn flex items-center gap-2 no-underline hover:no-underline" 111 title="Compare branches or tags" 112 > 113 {{ i "git-compare" "w-4 h-4" }} 114 </a> 115 </div> 116 </div> 117 </div> 118{{ end }} 119 120{{ define "fileTree" }} 121 <div id="file-tree" class="col-span-1 pr-2 md:border-r md:border-gray-200 dark:md:border-gray-700" > 122 {{ $linkstyle := "no-underline hover:underline dark:text-white" }} 123 124 {{ range .Files }} 125 <div class="grid grid-cols-3 gap-4 items-center py-1"> 126 <div class="col-span-2"> 127 {{ $link := printf "/%s/%s/%s/%s" $.RepoInfo.FullName "tree" (urlquery $.Ref) .Name }} 128 {{ $icon := "folder" }} 129 {{ $iconStyle := "size-4 fill-current" }} 130 131 {{ if .IsSubmodule }} 132 {{ $link = printf "/%s/%s/%s/%s" $.RepoInfo.FullName "blob" (urlquery $.Ref) .Name }} 133 {{ $icon = "folder-input" }} 134 {{ $iconStyle = "size-4" }} 135 {{ end }} 136 137 {{ if .IsFile }} 138 {{ $link = printf "/%s/%s/%s/%s" $.RepoInfo.FullName "blob" (urlquery $.Ref) .Name }} 139 {{ $icon = "file" }} 140 {{ $iconStyle = "size-4" }} 141 {{ end }} 142 143 <a href="{{ $link }}" class="{{ $linkstyle }}"> 144 <div class="flex items-center gap-2"> 145 {{ i $icon $iconStyle "flex-shrink-0" }} 146 <span class="truncate">{{ .Name }}</span> 147 </div> 148 </a> 149 </div> 150 151 <div class="text-sm col-span-1 text-right"> 152 {{ with .LastCommit }} 153 <a href="/{{ $.RepoInfo.FullName }}/commit/{{ .Hash }}" class="text-gray-500 dark:text-gray-400">{{ template "repo/fragments/time" .When }}</a> 154 {{ end }} 155 </div> 156 </div> 157 {{ end }} 158 </div> 159{{ end }} 160 161{{ define "rightInfo" }} 162 <div id="right-info" class="hidden md:block col-span-1"> 163 {{ block "commitLog" . }} {{ end }} 164 {{ block "branchList" . }} {{ end }} 165 {{ block "tagList" . }} {{ end }} 166 </div> 167{{ end }} 168 169{{ define "commitLog" }} 170<div id="commit-log" class="md:col-span-1 px-2 pb-4"> 171 <div class="flex justify-between items-center"> 172 {{ if .RepoInfo.IsPijul }} 173 <a href="/{{ .RepoInfo.FullName }}/changes/{{ .Ref | urlquery }}" class="flex items-center gap-2 pb-2 cursor-pointer font-bold hover:text-gray-600 dark:hover:text-gray-300 hover:no-underline"> 174 {{ i "logs" "w-4 h-4" }} changes 175 <span class="bg-gray-100 dark:bg-gray-700 font-normal rounded py-1/2 px-1 text-sm">{{ .TotalCommits }}</span> 176 </a> 177 {{ else }} 178 <a href="/{{ .RepoInfo.FullName }}/commits/{{ .Ref | urlquery }}" class="flex items-center gap-2 pb-2 cursor-pointer font-bold hover:text-gray-600 dark:hover:text-gray-300 hover:no-underline"> 179 {{ i "logs" "w-4 h-4" }} commits 180 <span class="bg-gray-100 dark:bg-gray-700 font-normal rounded py-1/2 px-1 text-sm">{{ .TotalCommits }}</span> 181 </a> 182 {{ end }} 183 </div> 184 <div class="flex flex-col gap-6"> 185 {{ if .RepoInfo.IsPijul }} 186 <div class="text-sm text-gray-500 dark:text-gray-400">See changes for the latest activity.</div> 187 {{ else }} 188 {{ range .CommitsTrunc }} 189 <div> 190 <div id="commit-message"> 191 {{ $messageParts := splitN .Message "\n\n" 2 }} 192 <div class="text-base cursor-pointer"> 193 <div> 194 <div> 195 <a 196 href="/{{ $.RepoInfo.FullName }}/commit/{{ .Hash.String }}" 197 class="inline no-underline hover:underline dark:text-white" 198 >{{ index $messageParts 0 }}</a 199 > 200 {{ if gt (len $messageParts) 1 }} 201 202 <button 203 class="py-1/2 px-1 bg-gray-200 hover:bg-gray-400 rounded dark:bg-gray-700 dark:hover:bg-gray-600" 204 hx-on:click="this.parentElement.nextElementSibling.classList.toggle('hidden')" 205 > 206 {{ i "ellipsis" "w-3 h-3" }} 207 </button> 208 {{ end }} 209 </div> 210 {{ if gt (len $messageParts) 1 }} 211 <p 212 class="hidden mt-1 text-sm cursor-text pb-2 dark:text-gray-300" 213 > 214 {{ nl2br (index $messageParts 1) }} 215 </p> 216 {{ end }} 217 </div> 218 </div> 219 </div> 220 221 <!-- commit info bar --> 222 <div class="text-xs mt-2 text-gray-500 dark:text-gray-400 flex items-center flex-wrap"> 223 {{ $verified := $.VerifiedCommits.IsVerified .Hash.String }} 224 {{ $hashStyle := "text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-900" }} 225 {{ if $verified }} 226 {{ $hashStyle = "bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200 px-2 rounded" }} 227 {{ end }} 228 <span class="font-mono"> 229 <a href="/{{ $.RepoInfo.FullName }}/commit/{{ .Hash.String }}" 230 class="no-underline hover:underline {{ $hashStyle }} px-2 py-1 rounded flex items-center gap-2"> 231 {{ slice .Hash.String 0 8 }} 232 {{ if $verified }} 233 {{ i "shield-check" "w-3 h-3" }} 234 {{ end }} 235 </a> 236 </span> 237 <span 238 class="mx-1 before:content-['·'] before:select-none" 239 ></span> 240 {{ template "attribution" (list . $.EmailToDid) }} 241 <div class="inline-block px-1 select-none after:content-['·']"></div> 242 {{ template "repo/fragments/time" .Committer.When }} 243 244 <!-- tags/branches --> 245 {{ $tagsForCommit := index $.TagMap .Hash.String }} 246 {{ if gt (len $tagsForCommit) 0 }} 247 <div class="inline-block px-1 select-none after:content-['·']"></div> 248 {{ end }} 249 {{ range $tagsForCommit }} 250 <span class="text-xs rounded bg-gray-100 dark:bg-gray-700 text-black dark:text-white font-mono px-2 mx-[2px] inline-flex items-center"> 251 {{ . }} 252 </span> 253 {{ end }} 254 255 <!-- ci status --> 256 {{ $pipeline := index $.Pipelines .Hash.String }} 257 {{ if and $pipeline (gt (len $pipeline.Statuses) 0) }} 258 <div class="inline-block px-1 select-none after:content-['·']"></div> 259 {{ template "repo/pipelines/fragments/pipelineSymbolLong" (dict "RepoInfo" $.RepoInfo "Pipeline" $pipeline) }} 260 {{ end }} 261 </div> 262 </div> 263 {{ end }} 264 {{ end }} 265 </div> 266</div> 267{{ end }} 268 269{{ define "attribution" }} 270 {{ $commit := index . 0 }} 271 {{ $map := index . 1 }} 272 <span class="flex items-center gap-1"> 273 {{ $author := index $map $commit.Author.Email }} 274 {{ $coauthors := $commit.CoAuthors }} 275 {{ $all := list }} 276 277 {{ if $author }} 278 {{ $all = append $all $author }} 279 {{ end }} 280 {{ range $coauthors }} 281 {{ $co := index $map .Email }} 282 {{ if $co }} 283 {{ $all = append $all $co }} 284 {{ end }} 285 {{ end }} 286 287 {{ if $author }} 288 {{ template "fragments/tinyAvatarList" (dict "all" $all "classes" "size-6") }} 289 {{ else }} 290 {{ placeholderAvatar "tiny" }} 291 {{ end }} 292 <a href="{{ if $author }}/{{ $author }}{{ else }}mailto:{{ $commit.Author.Email }}{{ end }}" 293 class="no-underline hover:underline"> 294 {{ if $author }}{{ resolve $author }}{{ else }}{{ $commit.Author.Name }}{{ end }} 295 {{ if $coauthors }} +{{ length $coauthors }}{{ end }} 296 </a> 297 </span> 298{{ end }} 299 300{{ define "branchList" }} 301 {{ if gt (len .BranchesTrunc) 0 }} 302 <div id="branches" class="md:col-span-1 px-2 py-4 border-t border-gray-200 dark:border-gray-700"> 303 <a href="/{{ .RepoInfo.FullName }}/{{ if .RepoInfo.IsPijul }}channels{{ else }}branches{{ end }}" class="flex items-center gap-2 pb-2 cursor-pointer font-bold hover:text-gray-600 dark:hover:text-gray-300 hover:no-underline"> 304 {{ i "git-branch" "w-4 h-4" }} {{ if .RepoInfo.IsPijul }}channels{{ else }}branches{{ end }} 305 <span class="bg-gray-100 dark:bg-gray-700 font-normal rounded py-1/2 px-1 text-sm">{{ len .Branches }}</span> 306 </a> 307 <div class="flex flex-col gap-1"> 308 {{ range .BranchesTrunc }} 309 <div class="text-base flex items-center justify-between overflow-hidden"> 310 <div class="flex items-center gap-2 min-w-0 flex-1"> 311 <a href="/{{ $.RepoInfo.FullName }}/tree/{{ .Reference.Name | urlquery }}" 312 class="inline-block truncate no-underline hover:underline dark:text-white"> 313 {{ .Reference.Name }} 314 </a> 315 {{ if .Commit }} 316 <span class="px-1 text-gray-500 dark:text-gray-400 select-none after:content-['·'] shrink-0"></span> 317 <span class="whitespace-nowrap text-xs text-gray-500 dark:text-gray-400 shrink-0">{{ template "repo/fragments/time" .Commit.Committer.When }}</span> 318 {{ end }} 319 {{ if .IsDefault }} 320 <span class="px-1 text-gray-500 dark:text-gray-400 select-none after:content-['·'] shrink-0"></span> 321 <span class="bg-gray-200 dark:bg-gray-700 rounded py-1/2 px-1 text-xs font-mono shrink-0">default</span> 322 {{ end }} 323 </div> 324 {{ if ne $.Ref .Reference.Name }} 325 <a href="/{{ $.RepoInfo.FullName }}/compare/{{ $.Ref | urlquery }}...{{ .Reference.Name | urlquery }}" 326 class="text-xs flex gap-2 items-center shrink-0 ml-2" 327 title="Compare branches or tags"> 328 {{ i "git-compare" "w-3 h-3" }} compare 329 </a> 330 {{ end }} 331 </div> 332 {{ end }} 333 </div> 334 </div> 335 {{ end }} 336{{ end }} 337 338{{ define "tagList" }} 339 {{ if and (not .RepoInfo.IsPijul) (gt (len .TagsTrunc) 0) }} 340 <div id="tags" class="md:col-span-1 px-2 py-4 border-t border-gray-200 dark:border-gray-700"> 341 <div class="flex justify-between items-center"> 342 <a href="/{{ .RepoInfo.FullName }}/tags" class="flex items-center gap-2 pb-2 cursor-pointer font-bold hover:text-gray-600 dark:hover:text-gray-300 hover:no-underline"> 343 {{ i "tags" "w-4 h-4" }} tags 344 <span class="bg-gray-100 dark:bg-gray-700 font-normal rounded py-1/2 px-1 text-sm">{{ len .Tags }}</span> 345 </a> 346 </div> 347 <div class="flex flex-col gap-1"> 348 {{ range $idx, $tag := .TagsTrunc }} 349 {{ with $tag }} 350 <div> 351 <div class="text-base flex items-center gap-2"> 352 <a href="/{{ $.RepoInfo.FullName }}/tags/{{ .Reference.Name | urlquery }}" 353 class="inline no-underline hover:underline dark:text-white"> 354 {{ .Reference.Name }} 355 </a> 356 </div> 357 <div> 358 {{ with .Tag }} 359 <span class="text-xs text-gray-500 dark:text-gray-400">{{ template "repo/fragments/time" .Tagger.When }}</span> 360 {{ end }} 361 {{ if eq $idx 0 }} 362 {{ with .Tag }}<span class="px-1 text-gray-500 dark:text-gray-400 select-none after:content-['·']"></span>{{ end }} 363 <span class="bg-gray-200 dark:bg-gray-700 rounded py-1/2 px-1 text-xs font-mono">latest</span> 364 {{ end }} 365 </div> 366 </div> 367 {{ end }} 368 {{ end }} 369 </div> 370 </div> 371 {{ end }} 372{{ end }} 373 374{{ define "repoAfter" }} 375 {{- if or .HTMLReadme .Readme -}} 376 {{ template "repo/fragments/readme" . }} 377 {{- end -}} 378{{ end }}