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