98 lines
2.9 kB
1
{{define "repoContent"}}
2
3
<main>
4
{{- if .IsEmpty }}
5
this repo is empty
6
{{ else }}
7
<div class="flex gap-4">
8
<div id="file-tree" class="w-1/2">
9
{{ $containerstyle := "py-1" }}
10
{{ $linkstyle := "no-underline hover:underline" }}
11
12
{{ range .Files }}
13
{{ if not .IsFile }}
14
<div class="{{ $containerstyle }}">
15
<a href="/{{ $.RepoInfo.FullName }}/tree/{{ $.Ref }}/{{ .Name }}" class="{{ $linkstyle }}">
16
<div class="flex items-center gap-2">
17
<i class="w-3 h-3 fill-current" data-lucide="folder"></i>{{ .Name }}/
18
</div>
19
</a>
20
</div>
21
{{ end }}
22
{{ end }}
23
24
{{ range .Files }}
25
{{ if .IsFile }}
26
<div class="{{ $containerstyle }}">
27
<a href="/{{ $.RepoInfo.FullName }}/blob/{{ $.Ref }}/{{ .Name }}" class="{{ $linkstyle }}">
28
<div class="flex items-center gap-2">
29
<i class="w-3 h-3" data-lucide="file"></i>{{ .Name }}
30
</div>
31
</a>
32
</div>
33
{{ end }}
34
{{ end }}
35
</div>
36
<div id="commit-log" class="flex-1">
37
{{ range .Commits }}
38
<div class=
39
"relative
40
px-4
41
py-4
42
border-l
43
border-black
44
before:content-['']
45
before:absolute
46
before:w-1
47
before:h-1
48
before:bg-black
49
before:rounded-full
50
before:left-[-2.2px]
51
before:top-1/2
52
before:-translate-y-1/2
53
">
54
55
<div id="commit-message">
56
{{ $messageParts := splitN .Message "\n\n" 2 }}
57
<div class="text-base cursor-pointer">
58
{{ index $messageParts 0 }}
59
{{ if gt (len $messageParts) 1 }}
60
<div class="text-sm inline rounded-sm bg-gray-300 text-gray-700 px-1"
61
hx-on:click="this.nextElementSibling.classList.toggle('hidden')">...</div>
62
<div class="hidden mt-1 text-sm">{{ index $messageParts 1 }}</div>
63
{{ end }}
64
</div>
65
</div>
66
67
<div class="text-xs text-gray-500">
68
<span class="font-mono">
69
<a href="/{{ $.RepoInfo.FullName }}/commit/{{ .Hash.String }}" class="text-gray-500 no-underline hover:underline">{{ slice .Hash.String 0 8 }}</a>
70
</span>
71
·
72
<span>
73
<a href="mailto:{{ .Author.Email }}" class="text-gray-500 no-underline hover:underline">{{ .Author.Name }}</a>
74
</span>
75
·
76
<span>{{ timeFmt .Author.When }}</span>
77
</div>
78
79
</div>
80
{{ end }}
81
</div>
82
</div>
83
{{- if .Readme }}
84
<article class="readme">
85
{{- .Readme -}}
86
</article>
87
{{- end -}}
88
{{- end -}}
89
90
<div class="clone-url">
91
<strong>clone</strong>
92
<pre>
93
git clone https://tangled.sh/{{ .RepoInfo.OwnerWithAt }}/{{ .RepoInfo.Name }}
94
</pre>
95
</div>
96
</main>
97
{{end}}
98
99