This repository has no description
0

Configure Feed

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

core / appview / pages / templates / user / fragments / repoCard.html
3.7 kB 101 lines
1{{ define "user/fragments/repoCard" }} 2 {{/* root, repo, fullName [,starButton [,starData{IsStarred,SubjectAt,StarCount,RepoName} [,compact [,cardLink]]]] */}} 3 {{ $root := index . 0 }} 4 {{ $repo := index . 1 }} 5 {{ $fullName := index . 2 }} 6 {{ $starButton := false }} 7 {{ $starData := dict }} 8 {{ $compact := false }} 9 {{ $cardLink := false }} 10 {{ if gt (len .) 3 }} 11 {{ $starButton = index . 3 }} 12 {{ if gt (len .) 4 }} 13 {{ $starData = index . 4 }} 14 {{ if gt (len .) 5 }} 15 {{ $compact = index . 5 }} 16 {{ if gt (len .) 6 }} 17 {{ $cardLink = index . 6 }} 18 {{ end }} 19 {{ end }} 20 {{ end }} 21 {{ end }} 22 23 {{ with $repo }} 24 {{ $repoOwner := resolve .Did }} 25 {{ if $cardLink }} 26 <a href="/{{ $repoOwner }}/{{ .Slug }}" data-nav-result class="hover:no-underline {{ if not $compact }} min-h-32 {{ end }} {{ if $compact }} hover:bg-gray-100 dark:hover:bg-gray-800/80 focus-within:bg-gray-100 dark:focus-within:bg-gray-800/80 {{ end }} py-4 px-6 gap-1 flex flex-col drop-shadow-sm bg-white dark:bg-gray-800"> 27 {{ else }} 28 <div class="{{ if not $compact }} min-h-32 {{ end }} {{ if $compact }} focus-within:bg-gray-100 dark:focus-within:bg-gray-800/80 {{ end }} py-4 px-6 gap-1 flex flex-col drop-shadow-sm bg-white dark:bg-gray-800"> 29 {{ end }} 30 <div class="dark:text-white flex items-center justify-between"> 31 <div class="flex items-center min-w-0 flex-1 mr-2"> 32 {{ if .Source }} 33 {{ i "git-fork" "w-4 h-4 mr-1.5 shrink-0" }} 34 {{ else }} 35 {{ i "book-marked" "w-4 h-4 mr-1.5 shrink-0" }} 36 {{ end }} 37 {{- $label := .Name -}} 38 {{- if $fullName -}}{{- $label = print $repoOwner "/" .Name -}}{{- end -}} 39 {{- if $cardLink -}} 40 <span class="truncate min-w-0">{{ $label }}</span> 41 {{- else -}} 42 <a href="/{{ $repoOwner }}/{{ .Slug }}" data-nav-result class="truncate min-w-0 {{ if $compact }} focus:outline-none {{ end }}">{{ $label }}</a> 43 {{- end -}} 44 </div> 45 {{ if and $starButton $root.LoggedInUser }} 46 <div class="shrink-0"> 47 {{ template "fragments/starBtn" $starData }} 48 </div> 49 {{ end }} 50 </div> 51 {{ with .Description }} 52 <div class="text-gray-600 dark:text-gray-300 text-sm line-clamp-2"> 53 {{ . | description }} 54 </div> 55 {{ end }} 56 57 {{ if .RepoStats }} 58 {{ block "repoStats" .RepoStats }}{{ end }} 59 {{ end }} 60 {{ if $cardLink }} 61 </a> 62 {{ else }} 63 </div> 64 {{ end }} 65 {{ end }} 66{{ end }} 67 68{{ define "repoStats" }} 69 <div class="text-gray-400 text-sm font-mono inline-flex gap-4 mt-auto"> 70 {{ with .Language }} 71 <div class="flex gap-2 items-center text-sm"> 72 {{ template "repo/fragments/colorBall" (dict "color" (langColor .)) }} 73 <span>{{ . }}</span> 74 </div> 75 {{ end }} 76 {{ with .StarCount }} 77 <div class="flex gap-1 items-center text-sm"> 78 {{ i "star" "w-3 h-3 fill-current" }} 79 <span>{{ scaleFmt . }}</span> 80 </div> 81 {{ end }} 82 {{ with .ForkCount }} 83 <div class="flex gap-1 items-center text-sm"> 84 {{ i "git-fork" "w-3 h-3" }} 85 <span>{{ scaleFmt . }}</span> 86 </div> 87 {{ end }} 88 {{ with .IssueCount.Open }} 89 <div class="flex gap-1 items-center text-sm"> 90 {{ i "circle-dot" "w-3 h-3" }} 91 <span>{{ scaleFmt . }}</span> 92 </div> 93 {{ end }} 94 {{ with .PullCount.Open }} 95 <div class="flex gap-1 items-center text-sm"> 96 {{ i "git-pull-request" "w-3 h-3" }} 97 <span>{{ scaleFmt . }}</span> 98 </div> 99 {{ end }} 100 </div> 101{{ end }}