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