this repo has no description
1{{ define "repoContent" }}
2 <main>
3 {{- if .IsEmpty }}
4 this repo is empty
5 {{ else }}
6 <div class="flex gap-4">
7 <div id="file-tree" class="w-1/2">
8 {{ $containerstyle := "py-1" }}
9 {{ $linkstyle := "no-underline hover:underline" }}
10
11
12 <div class="flex justify-end">
13 <select
14 hx-get="/{{ .RepoInfo.FullName }}/tree/"
15 hx-on::config-request = "event.detail.path += this.value"
16 hx-trigger="change"
17 hx-target="#repo-content"
18 hx-select="#repo-content"
19 hx-push-url="true"
20 class="p-1 border border-gray-500 bg-white"
21 >
22 <optgroup label="branches" class="font-semibold">
23 {{ range .Branches }}
24 <option
25 value="{{ .Reference.Name }}"
26 class="py-1"
27 >
28 {{ .Reference.Name }}
29 </option>
30 {{ end }}
31 </optgroup>
32 <optgroup label="tags" class="font-semibold">
33 {{ range .Tags }}
34 <option
35 value="{{ .Reference.Name }}"
36 class="py-1"
37 >
38 {{ .Reference.Name }}
39 </option>
40 {{ end }}
41 </optgroup>
42 </select>
43 </div>
44
45 <section id="repo-content">
46 {{ range .Files }}
47 {{ if not .IsFile }}
48 <div class="{{ $containerstyle }}">
49 <a
50 href="/{{ $.RepoInfo.FullName }}/tree/{{ $.Ref }}/{{ .Name }}"
51 class="{{ $linkstyle }}"
52 >
53 <div class="flex items-center gap-2">
54 <i
55 class="w-3 h-3 fill-current"
56 data-lucide="folder"
57 ></i
58 >{{ .Name }}/
59 </div>
60 </a>
61 </div>
62 {{ end }}
63 {{ end }}
64
65 {{ range .Files }}
66 {{ if .IsFile }}
67 <div class="{{ $containerstyle }}">
68 <a
69 href="/{{ $.RepoInfo.FullName }}/blob/{{ $.Ref }}/{{ .Name }}"
70 class="{{ $linkstyle }}"
71 >
72 <div class="flex items-center gap-2">
73 <i
74 class="w-3 h-3"
75 data-lucide="file"
76 ></i
77 >{{ .Name }}
78 </div>
79 </a>
80 </div>
81 {{ end }}
82 {{ end }}
83 </div>
84 <div id="commit-log" class="flex-1">
85 {{ range .Commits }}
86 <div
87 class="relative
88 px-4
89 py-4
90 border-l
91 border-black
92 before:content-['']
93 before:absolute
94 before:w-1
95 before:h-1
96 before:bg-black
97 before:rounded-full
98 before:left-[-2.2px]
99 before:top-1/2
100 before:-translate-y-1/2
101 ">
102
103 <div id="commit-message">
104 {{ $messageParts := splitN .Message "\n\n" 2 }}
105 <div class="text-base cursor-pointer">
106 <div>
107 <div class="flex items-center gap-1">
108 <a href="/{{ $.RepoInfo.FullName }}/commit/{{ .Hash.String }}" class="inline no-underline hover:underline hover:text-sky-400">{{ index $messageParts 0 }}</a>
109 {{ if gt (len $messageParts) 1 }}
110 <button class="text-sm inline rounded-sm bg-gray-300 text-gray-700 px-1 w-fit hover:bg-gray-400"
111 hx-on:click="this.parentElement.nextElementSibling.classList.toggle('hidden')">…</button>
112 {{ end }}
113 </div>
114 {{ if gt (len $messageParts) 1 }}
115 <p class="hidden mt-1 text-sm cursor-text pb-2">{{ nl2br (unwrapText (index $messageParts 1)) }}</p>
116 {{ end }}
117 </div>
118 </div>
119 </div>
120
121 <div class="text-xs text-gray-500">
122 <span class="font-mono">
123 <a
124 href="/{{ $.RepoInfo.FullName }}/commit/{{ .Hash.String }}"
125 class="text-gray-500 no-underline hover:underline"
126 >{{ slice .Hash.String 0 8 }}</a
127 >
128 </span>
129 ·
130 <span>
131 <a
132 href="mailto:{{ .Author.Email }}"
133 class="text-gray-500 no-underline hover:underline"
134 >{{ .Author.Name }}</a
135 >
136 </span>
137 ·
138 <span>{{ timeFmt .Author.When }}</span>
139 </div>
140 </div>
141 {{ end }}
142 </div>
143 </div>
144 </section>
145 {{- if .Readme }}
146 <article class="readme">
147 {{- .Readme -}}
148 </article>
149 {{- end -}}
150 {{- end -}}
151
152
153 <div class="clone-url">
154 <strong>clone</strong>
155 <pre>
156git clone https://tangled.sh/{{ .RepoInfo.OwnerWithAt }}/{{ .RepoInfo.Name }}
157 </pre
158 >
159 </div>
160 </main>
161{{ end }}