Monorepo for Tangled
at 74318eac9fdd72cf69e916276814351931ed0dcb 135 lines 5.2 kB view raw
1{{ define "title" }}{{ .RepoInfo.FullName }}{{ end }} 2 3{{ define "content" }} 4 <section id="repo-header" class="mb-2 py-2 px-4 dark:text-white"> 5 <div class="flex flex-col sm:flex-row items-start gap-4 justify-between mb-2"> 6 <div class="flex flex-col gap-2"> 7 {{ template "repoOwnerAndName" . }} 8 {{ template "repoForkInfo" . }} 9 </div> 10 <div class="hidden sm:block sm:flex-shrink-0"> 11 {{ template "repoActions" . }} 12 </div> 13 </div> 14 {{ template "repoMetadata" . }} 15 16 <div class="block sm:hidden mt-4"> 17 {{ template "repoActions" . }} 18 </div> 19 </section> 20 21 <section class="w-full flex flex-col" > 22 <nav class="w-full pl-4 overflow-auto"> 23 <div class="flex z-60"> 24 {{ $activeTabStyles := "-mb-px bg-white dark:bg-gray-800" }} 25 {{ $tabs := .RepoInfo.GetTabs }} 26 {{ $tabmeta := .RepoInfo.TabMetadata }} 27 {{ range $item := $tabs }} 28 {{ $key := index $item 0 }} 29 {{ $value := index $item 1 }} 30 {{ $icon := index $item 2 }} 31 {{ $meta := index $tabmeta $key }} 32 <a 33 href="/{{ $.RepoInfo.FullName }}{{ $value }}" 34 class="relative -mr-px group no-underline hover:no-underline" 35 hx-boost="true" 36 > 37 <div 38 class="px-4 py-1 mr-1 text-black dark:text-white min-w-[80px] text-center relative rounded-t whitespace-nowrap 39 {{ if eq $.Active $key }} 40 {{ $activeTabStyles }} 41 {{ else }} 42 group-hover:bg-gray-100/25 group-hover:dark:bg-gray-700/25 43 {{ end }} 44 " 45 > 46 <span class="flex items-center justify-center"> 47 {{ i $icon "w-4 h-4 mr-2" }} 48 {{ $key }} 49 {{ if $meta }} 50 <span class="bg-gray-200 dark:bg-gray-700 rounded py-1/2 px-1 text-sm ml-1">{{ $meta }}</span> 51 {{ end }} 52 </span> 53 </div> 54 </a> 55 {{ end }} 56 </div> 57 </nav> 58 {{ block "repoContentLayout" . }} 59 <section class="bg-white dark:bg-gray-800 px-6 py-4 rounded relative w-full mx-auto dark:text-white"> 60 {{ block "repoContent" . }}{{ end }} 61 </section> 62 {{ block "repoAfter" . }}{{ end }} 63 {{ end }} 64 </section> 65{{ end }} 66 67{{ define "repoOwnerAndName" }} 68 <div class="flex items-center gap-2 flex-wrap text-lg"> 69 {{ template "user/fragments/picHandleLink" .RepoInfo.OwnerDid }} 70 <span class="select-none">/</span> 71 <a href="/{{ .RepoInfo.FullName }}" class="font-bold">{{ .RepoInfo.Name }}</a> 72 </div> 73{{ end }} 74 75{{ define "repoForkInfo" }} 76 {{ if .RepoInfo.Source }} 77 {{ $sourceOwner := resolve .RepoInfo.Source.Did }} 78 <div class="flex items-center gap-1 text-sm text-gray-600 dark:text-gray-300 mb-2 flex-wrap"> 79 {{ i "git-fork" "w-3 h-3 shrink-0" }} 80 <span>forked from</span> 81 <a class="underline" href="/{{ $sourceOwner }}/{{ .RepoInfo.Source.Name }}"> 82 {{ $sourceOwner }}/{{ .RepoInfo.Source.Name }} 83 </a> 84 </div> 85 {{ end }} 86{{ end }} 87 88{{ define "repoMetadata" }} 89 <div class="flex flex-wrap items-center gap-x-4 gap-y-2 text-sm text-gray-600 dark:text-gray-300"> 90 {{ if .RepoInfo.Description }} 91 {{ .RepoInfo.Description | description }} 92 {{ else }} 93 <span class="italic">this repo has no description</span> 94 {{ end }} 95 96 {{ with .RepoInfo.Website }} 97 <span class="flex items-center gap-1"> 98 <span class="flex-shrink-0">{{ i "globe" "size-4" }}</span> 99 <a href="{{ . }}">{{ . | trimUriScheme }}</a> 100 </span> 101 {{ end }} 102 103 {{ if .RepoInfo.Topics }} 104 <div class="flex items-center gap-1"> 105 {{ range .RepoInfo.Topics }} 106 <span class="bg-gray-200 dark:bg-gray-700 rounded py-1/2 px-1 text-sm">{{ . }}</span> 107 {{ end }} 108 </div> 109 {{ end }} 110 </div> 111{{ end }} 112 113{{ define "repoActions" }} 114 <div class="w-full sm:w-fit grid grid-cols-3 gap-2 z-auto"> 115 {{ template "fragments/starBtn" 116 (dict "SubjectAt" .RepoInfo.RepoAt 117 "IsStarred" .RepoInfo.IsStarred 118 "StarCount" .RepoInfo.Stats.StarCount) }} 119 <a 120 class="btn text-sm no-underline hover:no-underline flex items-center gap-2 group" 121 hx-boost="true" 122 href="/{{ .RepoInfo.FullName }}/fork" 123 > 124 {{ i "git-fork" "w-4 h-4" }} 125 fork 126 {{ i "loader-circle" "w-4 h-4 animate-spin hidden group-[.htmx-request]:inline" }} 127 </a> 128 <a 129 class="btn text-sm no-underline hover:no-underline flex items-center gap-2 group" 130 href="/{{ .RepoInfo.FullName }}/feed.atom"> 131 {{ i "rss" "size-4" }} 132 <span class="md:hidden">atom</span> 133 </a> 134 </div> 135{{ end }}