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