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 md:hidden items-center gap-2">
18 <a href="/{{ .RepoInfo.FullName }}/commits/{{ .Ref | urlquery }}" class="inline-flex 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 }}/branches" class="inline-flex items-center text-sm gap-1 font-bold">
22 {{ i "git-branch" "w-4" "h-4" }} {{ len .Branches }}
23 </a>
24 <a href="/{{ .RepoInfo.FullName }}/tags" class="inline-flex items-center text-sm gap-1 font-bold">
25 {{ i "tags" "w-4" "h-4" }} {{ 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-center">
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
114 <!-- Clone dropdown in top right -->
115 <div class="hidden md:flex items-center ">
116 {{ template "repo/fragments/cloneDropdown" . }}
117 </div>
118 </div>
119{{ end }}
120
121{{ define "fileTree" }}
122 <div id="file-tree" class="col-span-1 pr-2 md:border-r md:border-gray-200 dark:md:border-gray-700" >
123 {{ $linkstyle := "no-underline hover:underline dark:text-white" }}
124
125 {{ range .Files }}
126 <div class="grid grid-cols-3 gap-4 items-center py-1">
127 <div class="col-span-2">
128 {{ $link := printf "/%s/%s/%s/%s" $.RepoInfo.FullName "tree" (urlquery $.Ref) .Name }}
129 {{ $icon := "folder" }}
130 {{ $iconStyle := "size-4 fill-current" }}
131
132 {{ if .IsSubmodule }}
133 {{ $link = printf "/%s/%s/%s/%s" $.RepoInfo.FullName "blob" (urlquery $.Ref) .Name }}
134 {{ $icon = "folder-input" }}
135 {{ $iconStyle = "size-4" }}
136 {{ end }}
137
138 {{ if .IsFile }}
139 {{ $link = printf "/%s/%s/%s/%s" $.RepoInfo.FullName "blob" (urlquery $.Ref) .Name }}
140 {{ $icon = "file" }}
141 {{ $iconStyle = "size-4" }}
142 {{ end }}
143
144 <a href="{{ $link }}" class="{{ $linkstyle }}">
145 <div class="flex items-center gap-2">
146 {{ i $icon $iconStyle "flex-shrink-0" }}
147 <span class="truncate">{{ .Name }}</span>
148 </div>
149 </a>
150 </div>
151
152 <div class="text-sm col-span-1 text-right">
153 {{ with .LastCommit }}
154 <a href="/{{ $.RepoInfo.FullName }}/commit/{{ .Hash }}" class="text-gray-500 dark:text-gray-400">{{ template "repo/fragments/time" .When }}</a>
155 {{ end }}
156 </div>
157 </div>
158 {{ end }}
159 </div>
160{{ end }}
161
162{{ define "rightInfo" }}
163 <div id="right-info" class="hidden md:block col-span-1">
164 {{ block "commitLog" . }} {{ end }}
165 {{ block "branchList" . }} {{ end }}
166 {{ block "tagList" . }} {{ end }}
167 </div>
168{{ end }}
169
170{{ define "commitLog" }}
171<div id="commit-log" class="md:col-span-1 px-2 pb-4">
172 <div class="flex justify-between items-center">
173 <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">
174 {{ i "logs" "w-4 h-4" }} commits
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 </div>
178 <div class="flex flex-col gap-6">
179 {{ range .CommitsTrunc }}
180 <div>
181 <div id="commit-message">
182 {{ $messageParts := splitN .Message "\n\n" 2 }}
183 <div class="text-base cursor-pointer">
184 <div>
185 <div>
186 <a
187 href="/{{ $.RepoInfo.FullName }}/commit/{{ .Hash.String }}"
188 class="inline no-underline hover:underline dark:text-white"
189 >{{ index $messageParts 0 }}</a
190 >
191 {{ if gt (len $messageParts) 1 }}
192
193 <button
194 class="py-1/2 px-1 bg-gray-200 hover:bg-gray-400 rounded dark:bg-gray-700 dark:hover:bg-gray-600"
195 hx-on:click="this.parentElement.nextElementSibling.classList.toggle('hidden')"
196 >
197 {{ i "ellipsis" "w-3 h-3" }}
198 </button>
199 {{ end }}
200 </div>
201 {{ if gt (len $messageParts) 1 }}
202 <p
203 class="hidden mt-1 text-sm cursor-text pb-2 dark:text-gray-300"
204 >
205 {{ nl2br (index $messageParts 1) }}
206 </p>
207 {{ end }}
208 </div>
209 </div>
210 </div>
211
212 <!-- commit info bar -->
213 <div class="text-xs mt-2 text-gray-500 dark:text-gray-400 flex items-center flex-wrap">
214 {{ $verified := $.VerifiedCommits.IsVerified .Hash.String }}
215 {{ $hashStyle := "text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-900" }}
216 {{ if $verified }}
217 {{ $hashStyle = "bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200 px-2 rounded" }}
218 {{ end }}
219 <span class="font-mono">
220 <a href="/{{ $.RepoInfo.FullName }}/commit/{{ .Hash.String }}"
221 class="no-underline hover:underline {{ $hashStyle }} px-2 py-1 rounded flex items-center gap-2">
222 {{ slice .Hash.String 0 8 }}
223 {{ if $verified }}
224 {{ i "shield-check" "w-3 h-3" }}
225 {{ end }}
226 </a>
227 </span>
228 <span
229 class="mx-1 before:content-['·'] before:select-none"
230 ></span>
231 <span>
232 {{ $did := index $.EmailToDid .Author.Email }}
233 <a href="{{ if $did }}/{{ resolve $did }}{{ else }}mailto:{{ .Author.Email }}{{ end }}"
234 class="text-gray-500 dark:text-gray-400 no-underline hover:underline"
235 >{{ if $did }}{{ template "user/fragments/picHandleLink" $did }}{{ else }}{{ .Author.Name }}{{ end }}</a>
236 </span>
237 <div class="inline-block px-1 select-none after:content-['·']"></div>
238 {{ template "repo/fragments/time" .Committer.When }}
239
240 <!-- tags/branches -->
241 {{ $tagsForCommit := index $.TagMap .Hash.String }}
242 {{ if gt (len $tagsForCommit) 0 }}
243 <div class="inline-block px-1 select-none after:content-['·']"></div>
244 {{ end }}
245 {{ range $tagsForCommit }}
246 <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">
247 {{ . }}
248 </span>
249 {{ end }}
250
251 <!-- ci status -->
252 {{ $pipeline := index $.Pipelines .Hash.String }}
253 {{ if and $pipeline (gt (len $pipeline.Statuses) 0) }}
254 <div class="inline-block px-1 select-none after:content-['·']"></div>
255 {{ template "repo/pipelines/fragments/pipelineSymbolLong" (dict "RepoInfo" $.RepoInfo "Pipeline" $pipeline) }}
256 {{ end }}
257 </div>
258 </div>
259 {{ end }}
260 </div>
261</div>
262{{ end }}
263
264{{ define "branchList" }}
265 {{ if gt (len .BranchesTrunc) 0 }}
266 <div id="branches" class="md:col-span-1 px-2 py-4 border-t border-gray-200 dark:border-gray-700">
267 <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">
268 {{ i "git-branch" "w-4 h-4" }} branches
269 <span class="bg-gray-100 dark:bg-gray-700 font-normal rounded py-1/2 px-1 text-sm">{{ len .Branches }}</span>
270 </a>
271 <div class="flex flex-col gap-1">
272 {{ range .BranchesTrunc }}
273 <div class="text-base flex items-center justify-between overflow-hidden">
274 <div class="flex items-center gap-2 min-w-0 flex-1">
275 <a href="/{{ $.RepoInfo.FullName }}/tree/{{ .Reference.Name | urlquery }}"
276 class="inline-block truncate no-underline hover:underline dark:text-white">
277 {{ .Reference.Name }}
278 </a>
279 {{ if .Commit }}
280 <span class="px-1 text-gray-500 dark:text-gray-400 select-none after:content-['·'] shrink-0"></span>
281 <span class="whitespace-nowrap text-xs text-gray-500 dark:text-gray-400 shrink-0">{{ template "repo/fragments/time" .Commit.Committer.When }}</span>
282 {{ end }}
283 {{ if .IsDefault }}
284 <span class="px-1 text-gray-500 dark:text-gray-400 select-none after:content-['·'] shrink-0"></span>
285 <span class="bg-gray-200 dark:bg-gray-700 rounded py-1/2 px-1 text-xs font-mono shrink-0">default</span>
286 {{ end }}
287 </div>
288 {{ if ne $.Ref .Reference.Name }}
289 <a href="/{{ $.RepoInfo.FullName }}/compare/{{ $.Ref | urlquery }}...{{ .Reference.Name | urlquery }}"
290 class="text-xs flex gap-2 items-center shrink-0 ml-2"
291 title="Compare branches or tags">
292 {{ i "git-compare" "w-3 h-3" }} compare
293 </a>
294 {{ end }}
295 </div>
296 {{ end }}
297 </div>
298 </div>
299 {{ end }}
300{{ end }}
301
302{{ define "tagList" }}
303 {{ if gt (len .TagsTrunc) 0 }}
304 <div id="tags" class="md:col-span-1 px-2 py-4 border-t border-gray-200 dark:border-gray-700">
305 <div class="flex justify-between items-center">
306 <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">
307 {{ i "tags" "w-4 h-4" }} tags
308 <span class="bg-gray-100 dark:bg-gray-700 font-normal rounded py-1/2 px-1 text-sm">{{ len .Tags }}</span>
309 </a>
310 </div>
311 <div class="flex flex-col gap-1">
312 {{ range $idx, $tag := .TagsTrunc }}
313 {{ with $tag }}
314 <div>
315 <div class="text-base flex items-center gap-2">
316 <a href="/{{ $.RepoInfo.FullName }}/tree/{{ .Reference.Name | urlquery }}"
317 class="inline no-underline hover:underline dark:text-white">
318 {{ .Reference.Name }}
319 </a>
320 </div>
321 <div>
322 {{ with .Tag }}
323 <span class="text-xs text-gray-500 dark:text-gray-400">{{ template "repo/fragments/time" .Tagger.When }}</span>
324 {{ end }}
325 {{ if eq $idx 0 }}
326 {{ with .Tag }}<span class="px-1 text-gray-500 dark:text-gray-400 select-none after:content-['·']"></span>{{ end }}
327 <span class="bg-gray-200 dark:bg-gray-700 rounded py-1/2 px-1 text-xs font-mono">latest</span>
328 {{ end }}
329 </div>
330 </div>
331 {{ end }}
332 {{ end }}
333 </div>
334 </div>
335 {{ end }}
336{{ end }}
337
338{{ define "repoAfter" }}
339 {{- if or .HTMLReadme .Readme -}}
340 {{ template "repo/fragments/readme" . }}
341 {{- end -}}
342{{ end }}