Monorepo for Tangled tangled.org
6

Configure Feed

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

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