this repo has no description
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-4">
18 <a href="/{{ .RepoInfo.FullName }}/commits/{{ .Ref | urlquery }}" class="inline-flex items-center text-sm gap-1">
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">
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">
25 {{ i "tags" "w-4" "h-4" }} {{ len .Tags }}
26 </a>
27 </div>
28 </div>
29 <div class="grid grid-cols-1 md:grid-cols-2 gap-2">
30 {{ block "fileTree" . }}{{ end }}
31 {{ block "rightInfo" . }}{{ end }}
32 </div>
33 </main>
34{{ end }}
35
36{{ define "repoLanguages" }}
37 <div class="flex gap-[1px] -m-6 mb-6 overflow-hidden rounded-t">
38 {{ range $value := .Languages }}
39 <div
40 title='{{ or $value.Name "Other" }} {{ printf "%.1f" $value.Percentage }}%'
41 class="h-[4px] rounded-full"
42 style="background-color: {{ $value.Color }}; width: {{ $value.Percentage }}%"
43 ></div>
44 {{ end }}
45 </div>
46{{ end }}
47
48
49{{ define "branchSelector" }}
50 <div class="flex gap-2 items-center items-stretch justify-center">
51 <select
52 onchange="window.location.href = '/{{ .RepoInfo.FullName }}/tree/' + encodeURIComponent(this.value)"
53 class="p-1 border max-w-32 border-gray-200 bg-white dark:bg-gray-800 dark:text-white dark:border-gray-700"
54 >
55 <optgroup label="branches ({{len .Branches}})" class="bold text-sm">
56 {{ range .Branches }}
57 <option
58 value="{{ .Reference.Name }}"
59 class="py-1"
60 {{ if eq .Reference.Name $.Ref }}
61 selected
62 {{ end }}
63 >
64 {{ .Reference.Name }}
65 </option>
66 {{ end }}
67 </optgroup>
68 <optgroup label="tags ({{len .Tags}})" class="bold text-sm">
69 {{ range .Tags }}
70 <option
71 value="{{ .Reference.Name }}"
72 class="py-1"
73 {{ if eq .Reference.Name $.Ref }}
74 selected
75 {{ end }}
76 >
77 {{ .Reference.Name }}
78 </option>
79 {{ else }}
80 <option class="py-1" disabled>no tags found</option>
81 {{ end }}
82 </optgroup>
83 </select>
84 <div class="flex items-center gap-2">
85 {{ $isOwner := and .LoggedInUser .RepoInfo.Roles.IsOwner }}
86 {{ $isCollaborator := and .LoggedInUser .RepoInfo.Roles.IsCollaborator }}
87 {{ if and (or $isOwner $isCollaborator) .ForkInfo .ForkInfo.IsFork }}
88 {{ $disabled := "" }}
89 {{ $title := "" }}
90 {{ if eq .ForkInfo.Status 0 }}
91 {{ $disabled = "disabled" }}
92 {{ $title = "This branch is not behind the upstream" }}
93 {{ else if eq .ForkInfo.Status 2 }}
94 {{ $disabled = "disabled" }}
95 {{ $title = "This branch has conflicts that must be resolved" }}
96 {{ else if eq .ForkInfo.Status 3 }}
97 {{ $disabled = "disabled" }}
98 {{ $title = "This branch does not exist on the upstream" }}
99 {{ end }}
100
101 <button
102 id="syncBtn"
103 {{ $disabled }}
104 {{ if $title }}title="{{ $title }}"{{ end }}
105 class="btn flex gap-2 items-center disabled:opacity-50 disabled:cursor-not-allowed"
106 hx-post="/{{ .RepoInfo.FullName }}/fork/sync"
107 hx-trigger="click"
108 hx-swap="none"
109 >
110 {{ if $disabled }}
111 {{ i "refresh-cw-off" "w-4 h-4" }}
112 {{ else }}
113 {{ i "refresh-cw" "w-4 h-4" }}
114 {{ end }}
115 <span>sync</span>
116 </button>
117 {{ end }}
118 <a
119 href="/{{ .RepoInfo.FullName }}/compare?base={{ $.Ref | urlquery }}"
120 class="btn flex items-center gap-2 no-underline hover:no-underline"
121 title="Compare branches or tags"
122 >
123 {{ i "git-compare" "w-4 h-4" }}
124 </a>
125 </div>
126</div>
127{{ end }}
128
129{{ define "fileTree" }}
130 <div
131 id="file-tree"
132 class="col-span-1 pr-2 md:border-r md:border-gray-200 dark:md:border-gray-700"
133 >
134 {{ $containerstyle := "py-1" }}
135 {{ $linkstyle := "no-underline hover:underline dark:text-white" }}
136
137 {{ range .Files }}
138 {{ if not .IsFile }}
139 <div class="{{ $containerstyle }}">
140 <div class="flex justify-between items-center">
141 <a
142 href="/{{ $.RepoInfo.FullName }}/tree/{{ $.Ref | urlquery }}/{{ .Name }}"
143 class="{{ $linkstyle }}"
144 >
145 <div class="flex items-center gap-2">
146 {{ i "folder" "size-4 fill-current" }}
147 {{ .Name }}
148 </div>
149 </a>
150
151 {{ if .LastCommit }}
152 <time class="text-xs text-gray-500 dark:text-gray-400"
153 >{{ timeFmt .LastCommit.When }}</time
154 >
155 {{ end }}
156 </div>
157 </div>
158 {{ end }}
159 {{ end }}
160
161 {{ range .Files }}
162 {{ if .IsFile }}
163 <div class="{{ $containerstyle }}">
164 <div class="flex justify-between items-center">
165 <a
166 href="/{{ $.RepoInfo.FullName }}/blob/{{ $.Ref | urlquery }}/{{ .Name }}"
167 class="{{ $linkstyle }}"
168 >
169 <div class="flex items-center gap-2">
170 {{ i "file" "size-4" }}{{ .Name }}
171 </div>
172 </a>
173
174 {{ if .LastCommit }}
175 <time class="text-xs text-gray-500 dark:text-gray-400"
176 >{{ timeFmt .LastCommit.When }}</time
177 >
178 {{ end }}
179 </div>
180 </div>
181 {{ end }}
182 {{ end }}
183 </div>
184{{ end }}
185
186{{ define "rightInfo" }}
187 <div id="right-info" class="hidden md:block col-span-1">
188 {{ block "commitLog" . }} {{ end }}
189 {{ block "branchList" . }} {{ end }}
190 {{ block "tagList" . }} {{ end }}
191 </div>
192{{ end }}
193
194{{ define "commitLog" }}
195<div id="commit-log" class="md:col-span-1 px-2 pb-4">
196 <div class="flex justify-between items-center">
197 <a href="/{{ .RepoInfo.FullName }}/commits/{{ .Ref | urlquery }}" class="flex text-black dark:text-white items-center gap-4 pb-2 no-underline hover:no-underline group">
198 <div class="flex gap-2 items-center font-bold">
199 {{ i "logs" "w-4 h-4" }} commits
200 </div>
201 <span class="hidden group-hover:flex gap-2 items-center text-sm text-gray-500 dark:text-gray-400 ">
202 view {{ .TotalCommits }} commits {{ i "chevron-right" "w-4 h-4" }}
203 </span>
204 </a>
205 </div>
206 <div class="flex flex-col gap-6">
207 {{ range .CommitsTrunc }}
208 <div>
209 <div id="commit-message">
210 {{ $messageParts := splitN .Message "\n\n" 2 }}
211 <div class="text-base cursor-pointer">
212 <div>
213 <div>
214 <a
215 href="/{{ $.RepoInfo.FullName }}/commit/{{ .Hash.String }}"
216 class="inline no-underline hover:underline dark:text-white"
217 >{{ index $messageParts 0 }}</a
218 >
219 {{ if gt (len $messageParts) 1 }}
220
221 <button
222 class="py-1/2 px-1 bg-gray-200 hover:bg-gray-400 rounded dark:bg-gray-700 dark:hover:bg-gray-600"
223 hx-on:click="this.parentElement.nextElementSibling.classList.toggle('hidden')"
224 >
225 {{ i "ellipsis" "w-3 h-3" }}
226 </button>
227 {{ end }}
228 </div>
229 {{ if gt (len $messageParts) 1 }}
230 <p
231 class="hidden mt-1 text-sm cursor-text pb-2 dark:text-gray-300"
232 >
233 {{ nl2br (index $messageParts 1) }}
234 </p>
235 {{ end }}
236 </div>
237 </div>
238 </div>
239
240 <!-- commit info bar -->
241 <div class="text-xs mt-2 text-gray-500 dark:text-gray-400 flex items-center">
242 {{ $verified := $.VerifiedCommits.IsVerified .Hash.String }}
243 {{ $hashStyle := "text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-900" }}
244 {{ if $verified }}
245 {{ $hashStyle = "bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200 px-2 rounded" }}
246 {{ end }}
247 <span class="font-mono">
248 <a href="/{{ $.RepoInfo.FullName }}/commit/{{ .Hash.String }}"
249 class="no-underline hover:underline {{ $hashStyle }} px-2 py-1 rounded flex items-center gap-2">
250 {{ slice .Hash.String 0 8 }}
251 {{ if $verified }}
252 {{ i "shield-check" "w-3 h-3" }}
253 {{ end }}
254 </a>
255 </span>
256 <span
257 class="mx-1 before:content-['·'] before:select-none"
258 ></span>
259 <span>
260 {{ $didOrHandle := index $.EmailToDidOrHandle .Author.Email }}
261 <a
262 href="{{ if $didOrHandle }}
263 /{{ $didOrHandle }}
264 {{ else }}
265 mailto:{{ .Author.Email }}
266 {{ end }}"
267 class="text-gray-500 dark:text-gray-400 no-underline hover:underline"
268 >{{ if $didOrHandle }}
269 {{ $didOrHandle }}
270 {{ else }}
271 {{ .Author.Name }}
272 {{ end }}</a
273 >
274 </span>
275 <div class="inline-block px-1 select-none after:content-['·']"></div>
276 <span>{{ timeFmt .Committer.When }}</span>
277
278 <!-- tags/branches -->
279 {{ $tagsForCommit := index $.TagMap .Hash.String }}
280 {{ if gt (len $tagsForCommit) 0 }}
281 <div class="inline-block px-1 select-none after:content-['·']"></div>
282 {{ end }}
283 {{ range $tagsForCommit }}
284 <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">
285 {{ . }}
286 </span>
287 {{ end }}
288
289 <!-- ci status -->
290 {{ $pipeline := index $.Pipelines .Hash.String }}
291 {{ if and $pipeline (gt (len $pipeline.Statuses) 0) }}
292 <div class="inline-block px-1 select-none after:content-['·']"></div>
293 {{ template "repo/pipelines/fragments/pipelineSymbolLong" (dict "RepoInfo" $.RepoInfo "Pipeline" $pipeline) }}
294 {{ end }}
295 </div>
296 </div>
297 {{ end }}
298 </div>
299</div>
300{{ end }}
301
302{{ define "branchList" }}
303 {{ if gt (len .BranchesTrunc) 0 }}
304 <div id="branches" class="md:col-span-1 px-2 py-4 border-t border-gray-200 dark:border-gray-700">
305 <a href="/{{ .RepoInfo.FullName }}/branches" class="flex text-black dark:text-white items-center gap-4 pb-2 no-underline hover:no-underline group">
306 <div class="flex gap-2 items-center font-bold">
307 {{ i "git-branch" "w-4 h-4" }} branches
308 </div>
309 <span class="hidden group-hover:flex gap-2 items-center text-sm text-gray-500 dark:text-gray-400 ">
310 view {{ len .Branches }} branches {{ i "chevron-right" "w-4 h-4" }}
311 </span>
312 </a>
313 <div class="flex flex-col gap-1">
314 {{ range .BranchesTrunc }}
315 <div class="text-base flex items-center justify-between">
316 <div class="flex items-center gap-2">
317 <a href="/{{ $.RepoInfo.FullName }}/tree/{{ .Reference.Name | urlquery }}"
318 class="inline no-underline hover:underline dark:text-white">
319 {{ .Reference.Name }}
320 </a>
321 {{ if .Commit }}
322 <span class="px-1 text-gray-500 dark:text-gray-400 select-none after:content-['·']"></span>
323 <time class="text-xs text-gray-500 dark:text-gray-400">{{ timeFmt .Commit.Committer.When }}</time>
324 {{ end }}
325 {{ if .IsDefault }}
326 <span class="px-1 text-gray-500 dark:text-gray-400 select-none after:content-['·']"></span>
327 <span class="bg-gray-200 dark:bg-gray-700 rounded py-1/2 px-1 text-xs font-mono">default</span>
328 {{ end }}
329 </div>
330 {{ if ne $.Ref .Reference.Name }}
331 <a href="/{{ $.RepoInfo.FullName }}/compare/{{ $.Ref | urlquery }}...{{ .Reference.Name | urlquery }}"
332 class="text-xs flex gap-2 items-center"
333 title="Compare branches or tags">
334 {{ i "git-compare" "w-3 h-3" }} compare
335 </a>
336 {{end}}
337 </div>
338 {{ end }}
339 </div>
340 </div>
341 {{ end }}
342{{ end }}
343
344{{ define "tagList" }}
345 {{ if gt (len .TagsTrunc) 0 }}
346 <div id="tags" class="md:col-span-1 px-2 py-4 border-t border-gray-200 dark:border-gray-700">
347 <div class="flex justify-between items-center">
348 <a href="/{{ .RepoInfo.FullName }}/tags" class="flex text-black dark:text-white items-center gap-4 pb-2 no-underline hover:no-underline group">
349 <div class="flex gap-2 items-center font-bold">
350 {{ i "tags" "w-4 h-4" }} tags
351 </div>
352 <span class="hidden group-hover:flex gap-2 items-center text-sm text-gray-500 dark:text-gray-400 ">
353 view {{ len .Tags }} tags {{ i "chevron-right" "w-4 h-4" }}
354 </span>
355 </a>
356 </div>
357 <div class="flex flex-col gap-1">
358 {{ range $idx, $tag := .TagsTrunc }}
359 {{ with $tag }}
360 <div>
361 <div class="text-base flex items-center gap-2">
362 <a href="/{{ $.RepoInfo.FullName }}/tree/{{ .Reference.Name | urlquery }}"
363 class="inline no-underline hover:underline dark:text-white">
364 {{ .Reference.Name }}
365 </a>
366 </div>
367 <div>
368 {{ with .Tag }}
369 <time class="text-xs text-gray-500 dark:text-gray-400">{{ timeFmt .Tagger.When }}</time>
370 {{ end }}
371 {{ if eq $idx 0 }}
372 {{ with .Tag }}<span class="px-1 text-gray-500 dark:text-gray-400 select-none after:content-['·']"></span>{{ end }}
373 <span class="bg-gray-200 dark:bg-gray-700 rounded py-1/2 px-1 text-xs font-mono">latest</span>
374 {{ end }}
375 </div>
376 </div>
377 {{ end }}
378 {{ end }}
379 </div>
380 </div>
381 {{ end }}
382{{ end }}
383
384{{ define "repoAfter" }}
385 {{- if .HTMLReadme -}}
386 <section
387 class="p-6 mt-4 rounded-br rounded-bl bg-white dark:bg-gray-800 dark:text-white drop-shadow-sm w-full mx-auto overflow-auto {{ if not .Raw }}
388 prose dark:prose-invert dark:[&_pre]:bg-gray-900
389 dark:[&_code]:text-gray-300 dark:[&_pre_code]:bg-gray-900
390 dark:[&_pre]:border dark:[&_pre]:border-gray-700
391 {{ end }}"
392 >
393 <article class="{{ if .Raw }}whitespace-pre{{ end }}">{{- if .Raw -}}<pre class="dark:bg-gray-800 dark:text-white overflow-x-scroll">
394 {{- .HTMLReadme -}}
395 </pre>
396 {{- else -}}
397 {{ .HTMLReadme }}
398 {{- end -}}</article>
399 </section>
400 {{- end -}}
401
402 {{ template "repo/fragments/cloneInstructions" . }}
403{{ end }}