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 <select
36 onchange="window.location.href = '/{{ .RepoInfo.FullName }}/tree/' + encodeURIComponent(this.value)"
37 class="p-1 border max-w-32 border-gray-200 bg-white dark:bg-gray-800 dark:text-white dark:border-gray-700"
38 >
39 <optgroup label="branches ({{len .Branches}})" class="bold text-sm">
40 {{ range .Branches }}
41 <option
42 value="{{ .Reference.Name }}"
43 class="py-1"
44 {{ if eq .Reference.Name $.Ref }}
45 selected
46 {{ end }}
47 >
48 {{ .Reference.Name }}
49 </option>
50 {{ end }}
51 </optgroup>
52 <optgroup label="tags ({{len .Tags}})" class="bold text-sm">
53 {{ range .Tags }}
54 <option
55 value="{{ .Reference.Name }}"
56 class="py-1"
57 {{ if eq .Reference.Name $.Ref }}
58 selected
59 {{ end }}
60 >
61 {{ .Reference.Name }}
62 </option>
63 {{ else }}
64 <option class="py-1" disabled>no tags found</option>
65 {{ end }}
66 </optgroup>
67 </select>
68{{ end }}
69
70{{ define "fileTree" }}
71 <div
72 id="file-tree"
73 class="col-span-1 pr-2 md:border-r md:border-gray-200 dark:md:border-gray-700"
74 >
75 {{ $containerstyle := "py-1" }}
76 {{ $linkstyle := "no-underline hover:underline dark:text-white" }}
77
78 {{ range .Files }}
79 {{ if not .IsFile }}
80 <div class="{{ $containerstyle }}">
81 <div class="flex justify-between items-center">
82 <a
83 href="/{{ $.RepoInfo.FullName }}/tree/{{ $.Ref | urlquery }}/{{ .Name }}"
84 class="{{ $linkstyle }}"
85 >
86 <div class="flex items-center gap-2">
87 {{ i "folder" "size-4 fill-current" }}
88 {{ .Name }}
89 </div>
90 </a>
91
92 <time class="text-xs text-gray-500 dark:text-gray-400"
93 >{{ timeFmt .LastCommit.When }}</time
94 >
95 </div>
96 </div>
97 {{ end }}
98 {{ end }}
99
100 {{ range .Files }}
101 {{ if .IsFile }}
102 <div class="{{ $containerstyle }}">
103 <div class="flex justify-between items-center">
104 <a
105 href="/{{ $.RepoInfo.FullName }}/blob/{{ $.Ref | urlquery }}/{{ .Name }}"
106 class="{{ $linkstyle }}"
107 >
108 <div class="flex items-center gap-2">
109 {{ i "file" "size-4" }}{{ .Name }}
110 </div>
111 </a>
112
113 <time class="text-xs text-gray-500 dark:text-gray-400"
114 >{{ timeFmt .LastCommit.When }}</time
115 >
116 </div>
117 </div>
118 {{ end }}
119 {{ end }}
120 </div>
121{{ end }}
122
123{{ define "rightInfo" }}
124 <div id="right-info" class="hidden md:block col-span-1">
125 {{ block "commitLog" . }} {{ end }}
126 {{ block "branchList" . }} {{ end }}
127 {{ block "tagList" . }} {{ end }}
128 </div>
129{{ end }}
130
131{{ define "commitLog" }}
132<div id="commit-log" class="md:col-span-1 px-2 pb-4">
133 <div class="flex justify-between items-center">
134 <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">
135 <div class="flex gap-2 items-center font-bold">
136 {{ i "logs" "w-4 h-4" }} commits
137 </div>
138 <span class="hidden group-hover:flex gap-2 items-center text-sm text-gray-500 dark:text-gray-400 ">
139 view {{ .TotalCommits }} commits {{ i "chevron-right" "w-4 h-4" }}
140 </span>
141 </a>
142 </div>
143 <div class="flex flex-col gap-6">
144 {{ range .CommitsTrunc }}
145 <div>
146 <div id="commit-message">
147 {{ $messageParts := splitN .Message "\n\n" 2 }}
148 <div class="text-base cursor-pointer">
149 <div>
150 <div>
151 <a
152 href="/{{ $.RepoInfo.FullName }}/commit/{{ .Hash.String }}"
153 class="inline no-underline hover:underline dark:text-white"
154 >{{ index $messageParts 0 }}</a
155 >
156 {{ if gt (len $messageParts) 1 }}
157
158 <button
159 class="py-1/2 px-1 bg-gray-200 hover:bg-gray-400 rounded dark:bg-gray-700 dark:hover:bg-gray-600"
160 hx-on:click="this.parentElement.nextElementSibling.classList.toggle('hidden')"
161 >
162 {{ i "ellipsis" "w-3 h-3" }}
163 </button>
164 {{ end }}
165 </div>
166 {{ if gt (len $messageParts) 1 }}
167 <p
168 class="hidden mt-1 text-sm cursor-text pb-2 dark:text-gray-300"
169 >
170 {{ nl2br (index $messageParts 1) }}
171 </p>
172 {{ end }}
173 </div>
174 </div>
175 </div>
176
177 <div class="text-xs text-gray-500 dark:text-gray-400">
178 <span class="font-mono">
179 <a
180 href="/{{ $.RepoInfo.FullName }}/commit/{{ .Hash.String }}"
181 class="text-gray-500 dark:text-gray-400 no-underline hover:underline"
182 >{{ slice .Hash.String 0 8 }}</a
183 ></span
184 >
185 <span
186 class="mx-2 before:content-['·'] before:select-none"
187 ></span>
188 <span>
189 {{ $didOrHandle := index $.EmailToDidOrHandle .Author.Email }}
190 <a
191 href="{{ if $didOrHandle }}
192 /{{ $didOrHandle }}
193 {{ else }}
194 mailto:{{ .Author.Email }}
195 {{ end }}"
196 class="text-gray-500 dark:text-gray-400 no-underline hover:underline"
197 >{{ if $didOrHandle }}
198 {{ $didOrHandle }}
199 {{ else }}
200 {{ .Author.Name }}
201 {{ end }}</a
202 >
203 </span>
204 <div
205 class="inline-block px-1 select-none after:content-['·']"
206 ></div>
207 <span>{{ timeFmt .Author.When }}</span>
208 {{ $tagsForCommit := index $.TagMap .Hash.String }}
209 {{ if gt (len $tagsForCommit) 0 }}
210 <div
211 class="inline-block px-1 select-none after:content-['·']"
212 ></div>
213 {{ end }}
214 {{ range $tagsForCommit }}
215 <span
216 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"
217 >
218 {{ . }}
219 </span>
220 {{ end }}
221 </div>
222 </div>
223 {{ end }}
224 </div>
225</div>
226{{ end }}
227
228{{ define "branchList" }}
229 {{ if gt (len .BranchesTrunc) 0 }}
230 <div id="branches" class="md:col-span-1 px-2 py-4 border-t border-gray-200 dark:border-gray-700">
231 <a href="/{{ .RepoInfo.FullName }}/branches" class="flex text-black dark:text-white items-center gap-4 pb-2 no-underline hover:no-underline group">
232 <div class="flex gap-2 items-center font-bold">
233 {{ i "git-branch" "w-4 h-4" }} branches
234 </div>
235 <span class="hidden group-hover:flex gap-2 items-center text-sm text-gray-500 dark:text-gray-400 ">
236 view {{ len .Branches }} branches {{ i "chevron-right" "w-4 h-4" }}
237 </span>
238 </a>
239 <div class="flex flex-col gap-1">
240 {{ range .BranchesTrunc }}
241 <div class="text-base flex items-center gap-2">
242 <a href="/{{ $.RepoInfo.FullName }}/tree/{{ .Reference.Name | urlquery }}"
243 class="inline no-underline hover:underline dark:text-white">
244 {{ .Reference.Name }}
245 </a>
246 {{ if .Commit }}
247 <span class="px-1 text-gray-500 dark:text-gray-400 select-none after:content-['·']"></span>
248 <time class="text-xs text-gray-500 dark:text-gray-400">{{ timeFmt .Commit.Author.When }}</time>
249 {{ end }}
250 {{ if .IsDefault }}
251 <span class="px-1 text-gray-500 dark:text-gray-400 select-none after:content-['·']"></span>
252 <span class="bg-gray-200 dark:bg-gray-700 rounded py-1/2 px-1 text-xs font-mono">default</span>
253 {{ end }}
254 </div>
255 {{ end }}
256 </div>
257 </div>
258 {{ end }}
259{{ end }}
260
261{{ define "tagList" }}
262 {{ if gt (len .TagsTrunc) 0 }}
263 <div id="tags" class="md:col-span-1 px-2 py-4 border-t border-gray-200 dark:border-gray-700">
264 <div class="flex justify-between items-center">
265 <a href="/{{ .RepoInfo.FullName }}/tags" 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 "tags" "w-4 h-4" }} tags
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 .Tags }} tags {{ i "chevron-right" "w-4 h-4" }}
271 </span>
272 </a>
273 </div>
274 <div class="flex flex-col gap-1">
275 {{ range $idx, $tag := .TagsTrunc }}
276 {{ with $tag }}
277 <div>
278 <div class="text-base flex items-center gap-2">
279 <a href="/{{ $.RepoInfo.FullName }}/tree/{{ .Reference.Name | urlquery }}"
280 class="inline no-underline hover:underline dark:text-white">
281 {{ .Reference.Name }}
282 </a>
283 </div>
284 <div>
285 {{ with .Tag }}
286 <time class="text-xs text-gray-500 dark:text-gray-400">{{ timeFmt .Tagger.When }}</time>
287 {{ end }}
288 {{ if eq $idx 0 }}
289 <span class="px-1 text-gray-500 dark:text-gray-400 select-none after:content-['·']"></span>
290 <span class="bg-gray-200 dark:bg-gray-700 rounded py-1/2 px-1 text-xs font-mono">latest</span>
291 {{ end }}
292 </div>
293 </div>
294 {{ end }}
295 {{ end }}
296 </div>
297 </div>
298 {{ end }}
299{{ end }}
300
301{{ define "repoAfter" }}
302 {{- if .HTMLReadme -}}
303 <section
304 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 }}
305 prose dark:prose-invert dark:[&_pre]:bg-gray-900
306 dark:[&_code]:text-gray-300 dark:[&_pre_code]:bg-gray-900
307 dark:[&_pre]:border dark:[&_pre]:border-gray-700
308 {{ end }}"
309 >
310 <article class="{{ if .Raw }}whitespace-pre{{ end }}">{{- if .Raw -}}<pre class="dark:bg-gray-900 dark:text-gray-200 dark:border dark:border-gray-700 dark:p-4 dark:rounded">
311 {{- .HTMLReadme -}}
312 </pre>
313 {{- else -}}
314 {{ .HTMLReadme }}
315 {{- end -}}</article>
316 </section>
317 {{- end -}}
318
319 {{ template "repo/fragments/cloneInstructions" . }}
320{{ end }}