1{{ define "repoContent" }}
2 <main>
3 <div class="flex gap-4">
4 <div id="file-tree" class="w-3/5">
5 {{ $containerstyle := "py-1" }}
6 {{ $linkstyle := "no-underline hover:underline" }}
7
8
9 <div class="flex justify-end">
10 <select
11 onchange="window.location.href = '/{{ .RepoInfo.FullName }}/tree/' + this.value"
12 class="p-1 border border-gray-500 bg-white"
13 >
14 <optgroup label="branches" class="bold text-sm">
15 {{ range .Branches }}
16 <option
17 value="{{ .Reference.Name }}"
18 class="py-1"
19 {{ if eq .Reference.Name $.Ref }}
20 selected
21 {{ end }}
22 >
23 {{ .Reference.Name }}
24 </option>
25 {{ end }}
26 </optgroup>
27 <optgroup label="tags" class="bold text-sm">
28 {{ range .Tags }}
29 <option
30 value="{{ .Reference.Name }}"
31 class="py-1"
32 {{ if eq .Reference.Name $.Ref }}
33 selected
34 {{ end }}
35 >
36 {{ .Reference.Name }}
37 </option>
38 {{ else }}
39 <option class="py-1" disabled>
40 no tags found
41 </option>
42 {{ end }}
43 </optgroup>
44 </select>
45 </div>
46
47 {{ range .Files }}
48 {{ if not .IsFile }}
49 <div class="{{ $containerstyle }}">
50 <div class="flex justify-between items-center">
51 <a
52 href="/{{ $.RepoInfo.FullName }}/tree/{{ $.Ref }}/{{ .Name }}"
53 class="{{ $linkstyle }}"
54 >
55 <div class="flex items-center gap-2">
56 <i
57 class="w-3 h-3 fill-current"
58 data-lucide="folder"
59 ></i
60 >{{ .Name }}
61 </div>
62 </a>
63
64 <time class="text-xs text-gray-500"
65 >{{ timeFmt .LastCommit.Author.When }}</time
66 >
67 </div>
68 </div>
69 {{ end }}
70 {{ end }}
71
72 {{ range .Files }}
73 {{ if .IsFile }}
74 <div class="{{ $containerstyle }}">
75 <div class="flex justify-between items-center">
76 <a
77 href="/{{ $.RepoInfo.FullName }}/blob/{{ $.Ref }}/{{ .Name }}"
78 class="{{ $linkstyle }}"
79 >
80 <div class="flex items-center gap-2">
81 <i
82 class="w-3 h-3"
83 data-lucide="file"
84 ></i
85 >{{ .Name }}
86 </div>
87 </a>
88
89 <time class="text-xs text-gray-500"
90 >{{ timeFmt .LastCommit.Author.When }}</time
91 >
92 </div>
93 </div>
94 {{ end }}
95 {{ end }}
96 </div>
97 <div id="commit-log" class="flex-1">
98 {{ range .Commits }}
99 <div
100 class="relative
101 px-4
102 py-4
103 border-l
104 border-black
105 before:content-['']
106 before:absolute
107 before:w-1
108 before:h-1
109 before:bg-black
110 before:rounded-full
111 before:left-[-2.2px]
112 before:top-1/2
113 before:-translate-y-1/2
114 "
115 >
116 <div id="commit-message">
117 {{ $messageParts := splitN .Message "\n\n" 2 }}
118 <div class="text-base cursor-pointer">
119 <div>
120 <div>
121 <a
122 href="/{{ $.RepoInfo.FullName }}/commit/{{ .Hash.String }}"
123 class="inline no-underline hover:underline"
124 >{{ index $messageParts 0 }}</a
125 >
126 {{ if gt (len $messageParts) 1 }}
127
128 <button
129 class="py-1/2 px-1 bg-gray-200 hover:bg-gray-400 rounded"
130 hx-on:click="this.parentElement.nextElementSibling.classList.toggle('hidden')"
131 >
132 <i
133 class="w-3 h-3"
134 data-lucide="ellipsis"
135 ></i>
136 </button>
137 {{ end }}
138 </div>
139 {{ if gt (len $messageParts) 1 }}
140 <p
141 class="hidden mt-1 text-sm cursor-text pb-2"
142 >
143 {{ nl2br (unwrapText (index $messageParts 1)) }}
144 </p>
145 {{ end }}
146 </div>
147 </div>
148 </div>
149
150 <div class="text-xs text-gray-500">
151 <span class="font-mono">
152 <a
153 href="/{{ $.RepoInfo.FullName }}/commit/{{ .Hash.String }}"
154 class="text-gray-500 no-underline hover:underline"
155 >{{ slice .Hash.String 0 8 }}</a
156 >
157 </span>
158 <span
159 class="mx-2 before:content-['·'] before:select-none"
160 ></span>
161 <span>
162 <a
163 href="mailto:{{ .Author.Email }}"
164 class="text-gray-500 no-underline hover:underline"
165 >{{ .Author.Name }}</a
166 >
167 </span>
168 <div
169 class="inline-block px-1 select-none after:content-['·']"
170 ></div>
171 <span>{{ timeFmt .Author.When }}</span>
172 </div>
173 </div>
174 {{ end }}
175 </div>
176 </div>
177 </main>
178{{ end }}
179
180{{ define "repoAfter" }}
181 {{- if .Readme }}
182 <section class="mt-4 p-6 border border-black w-full mx-auto">
183 <article class="readme">
184 {{- .Readme -}}
185 </article>
186 </section>
187 {{- end -}}
188
189
190 <section class="mt-4 p-6 border border-black w-full mx-auto">
191 <strong>clone</strong>
192 <pre>
193 git clone https://tangled.sh/{{ .RepoInfo.OwnerWithAt }}/{{ .RepoInfo.Name }} </pre
194 >
195 </section>
196{{ end }}