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-4 items-center 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 text-gray-500 dark:text-gray-400">
226 <span class="font-mono">
227 <a
228 href="/{{ $.RepoInfo.FullName }}/commit/{{ .Hash.String }}"
229 class="text-gray-500 dark:text-gray-400 no-underline hover:underline"
230 >{{ slice .Hash.String 0 8 }}</a
231 ></span
232 >
233 <span
234 class="mx-2 before:content-['·'] before:select-none"
235 ></span>
236 <span>
237 {{ $didOrHandle := index $.EmailToDidOrHandle .Author.Email }}
238 <a
239 href="{{ if $didOrHandle }}
240 /{{ $didOrHandle }}
241 {{ else }}
242 mailto:{{ .Author.Email }}
243 {{ end }}"
244 class="text-gray-500 dark:text-gray-400 no-underline hover:underline"
245 >{{ if $didOrHandle }}
246 {{ $didOrHandle }}
247 {{ else }}
248 {{ .Author.Name }}
249 {{ end }}</a
250 >
251 </span>
252 <div
253 class="inline-block px-1 select-none after:content-['·']"
254 ></div>
255 <span>{{ timeFmt .Committer.When }}</span>
256 {{ $tagsForCommit := index $.TagMap .Hash.String }}
257 {{ if gt (len $tagsForCommit) 0 }}
258 <div
259 class="inline-block px-1 select-none after:content-['·']"
260 ></div>
261 {{ end }}
262 {{ range $tagsForCommit }}
263 <span
264 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"
265 >
266 {{ . }}
267 </span>
268 {{ end }}
269 </div>
270 </div>
271 {{ end }}
272 </div>
273</div>
274{{ end }}
275
276{{ define "branchList" }}
277 {{ if gt (len .BranchesTrunc) 0 }}
278 <div id="branches" class="md:col-span-1 px-2 py-4 border-t border-gray-200 dark:border-gray-700">
279 <a href="/{{ .RepoInfo.FullName }}/branches" class="flex text-black dark:text-white items-center gap-4 pb-2 no-underline hover:no-underline group">
280 <div class="flex gap-2 items-center font-bold">
281 {{ i "git-branch" "w-4 h-4" }} branches
282 </div>
283 <span class="hidden group-hover:flex gap-2 items-center text-sm text-gray-500 dark:text-gray-400 ">
284 view {{ len .Branches }} branches {{ i "chevron-right" "w-4 h-4" }}
285 </span>
286 </a>
287 <div class="flex flex-col gap-1">
288 {{ range .BranchesTrunc }}
289 <div class="text-base flex items-center gap-2">
290 <a href="/{{ $.RepoInfo.FullName }}/tree/{{ .Reference.Name | urlquery }}"
291 class="inline no-underline hover:underline dark:text-white">
292 {{ .Reference.Name }}
293 </a>
294 {{ if .Commit }}
295 <span class="px-1 text-gray-500 dark:text-gray-400 select-none after:content-['·']"></span>
296 <time class="text-xs text-gray-500 dark:text-gray-400">{{ timeFmt .Commit.Committer.When }}</time>
297 {{ end }}
298 {{ if .IsDefault }}
299 <span class="px-1 text-gray-500 dark:text-gray-400 select-none after:content-['·']"></span>
300 <span class="bg-gray-200 dark:bg-gray-700 rounded py-1/2 px-1 text-xs font-mono">default</span>
301 {{ end }}
302 </div>
303 {{ end }}
304 </div>
305 </div>
306 {{ end }}
307{{ end }}
308
309{{ define "tagList" }}
310 {{ if gt (len .TagsTrunc) 0 }}
311 <div id="tags" class="md:col-span-1 px-2 py-4 border-t border-gray-200 dark:border-gray-700">
312 <div class="flex justify-between items-center">
313 <a href="/{{ .RepoInfo.FullName }}/tags" class="flex text-black dark:text-white items-center gap-4 pb-2 no-underline hover:no-underline group">
314 <div class="flex gap-2 items-center font-bold">
315 {{ i "tags" "w-4 h-4" }} tags
316 </div>
317 <span class="hidden group-hover:flex gap-2 items-center text-sm text-gray-500 dark:text-gray-400 ">
318 view {{ len .Tags }} tags {{ i "chevron-right" "w-4 h-4" }}
319 </span>
320 </a>
321 </div>
322 <div class="flex flex-col gap-1">
323 {{ range $idx, $tag := .TagsTrunc }}
324 {{ with $tag }}
325 <div>
326 <div class="text-base flex items-center gap-2">
327 <a href="/{{ $.RepoInfo.FullName }}/tree/{{ .Reference.Name | urlquery }}"
328 class="inline no-underline hover:underline dark:text-white">
329 {{ .Reference.Name }}
330 </a>
331 </div>
332 <div>
333 {{ with .Tag }}
334 <time class="text-xs text-gray-500 dark:text-gray-400">{{ timeFmt .Tagger.When }}</time>
335 {{ end }}
336 {{ if eq $idx 0 }}
337 <span class="px-1 text-gray-500 dark:text-gray-400 select-none after:content-['·']"></span>
338 <span class="bg-gray-200 dark:bg-gray-700 rounded py-1/2 px-1 text-xs font-mono">latest</span>
339 {{ end }}
340 </div>
341 </div>
342 {{ end }}
343 {{ end }}
344 </div>
345 </div>
346 {{ end }}
347{{ end }}
348
349{{ define "repoAfter" }}
350 {{- if .HTMLReadme -}}
351 <section
352 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 }}
353 prose dark:prose-invert dark:[&_pre]:bg-gray-900
354 dark:[&_code]:text-gray-300 dark:[&_pre_code]:bg-gray-900
355 dark:[&_pre]:border dark:[&_pre]:border-gray-700
356 {{ end }}"
357 >
358 <article class="{{ if .Raw }}whitespace-pre{{ end }}">{{- if .Raw -}}<pre class="dark:bg-gray-800 dark:text-white overflow-x-scroll">
359 {{- .HTMLReadme -}}
360 </pre>
361 {{- else -}}
362 {{ .HTMLReadme }}
363 {{- end -}}</article>
364 </section>
365 {{- end -}}
366
367 {{ template "repo/fragments/cloneInstructions" . }}
368{{ end }}