Monorepo for Tangled
1{{ define "title"}}{{ range .BreadCrumbs }}{{ pathUnescape (index . 0)}}/{{ end }} at {{ .Ref }} · {{ .RepoInfo.FullName }}{{ end }}
2
3
4{{ define "extrameta" }}
5
6 {{ $path := "" }}
7 {{ range .BreadCrumbs }}
8 {{ $path = printf "%s/%s" $path (index . 0) }}
9 {{ end }}
10
11 {{ template "repo/fragments/meta" . }}
12 {{ $title := printf "%s at %s · %s" $path .Ref .RepoInfo.FullName }}
13 {{ $url := printf "https://tangled.org/%s/tree/%s%s" .RepoInfo.FullName .Ref $path }}
14
15 {{ template "repo/fragments/og" (dict "RepoInfo" .RepoInfo "Title" $title "Url" $url) }}
16{{ end }}
17
18
19{{define "repoContent"}}
20<main>
21 <div class="tree">
22 {{ $linkstyle := "no-underline hover:underline" }}
23
24 <div class="pb-2 mb-3 text-base border-b border-gray-200 dark:border-gray-700">
25 <div class="flex flex-col md:flex-row md:justify-between gap-2">
26 <div id="breadcrumbs" class="overflow-x-auto whitespace-nowrap text-gray-400 dark:text-gray-500">
27 {{ range .BreadCrumbs }}
28 <a href="{{ index . 1 }}" class="text-bold text-gray-500 dark:text-gray-400 {{ $linkstyle }}">{{ pathUnescape (index . 0) }}</a> /
29 {{ end }}
30 </div>
31 <div id="dir-info" class="text-gray-500 dark:text-gray-400 text-xs md:text-sm flex flex-wrap items-center gap-1 md:gap-0">
32 {{ $stats := .TreeStats }}
33
34 <span>at <a href="/{{ $.RepoInfo.FullName }}/tree/{{ pathEscape $.Ref }}">{{ $.Ref }}</a></span>
35 {{ if eq $stats.NumFolders 1 }}
36 <span class="select-none px-1 md:px-2 [&:before]:content-['·']"></span>
37 <span>{{ $stats.NumFolders }} folder</span>
38 {{ else if gt $stats.NumFolders 1 }}
39 <span class="select-none px-1 md:px-2 [&:before]:content-['·']"></span>
40 <span>{{ $stats.NumFolders }} folders</span>
41 {{ end }}
42
43 {{ if eq $stats.NumFiles 1 }}
44 <span class="select-none px-1 md:px-2 [&:before]:content-['·']"></span>
45 <span>{{ $stats.NumFiles }} file</span>
46 {{ else if gt $stats.NumFiles 1 }}
47 <span class="select-none px-1 md:px-2 [&:before]:content-['·']"></span>
48 <span>{{ $stats.NumFiles }} files</span>
49 {{ end }}
50
51 </div>
52 </div>
53 </div>
54
55 {{ if .LastCommitInfo }}
56 {{ template "repo/fragments/lastCommitPanel" $ }}
57 {{ end }}
58
59 {{ range .Files }}
60 <div class="grid grid-cols-12 gap-4 items-center py-1">
61 <div class="col-span-8 md:col-span-4">
62 {{ $link := printf "/%s/%s/%s/%s/%s" $.RepoInfo.FullName "tree" (pathEscape $.Ref) $.TreePath .Name }}
63 {{ $icon := "folder" }}
64 {{ $iconStyle := "size-4 fill-current" }}
65
66 {{ if .IsSubmodule }}
67 {{ $link = printf "/%s/%s/%s/%s/%s" $.RepoInfo.FullName "blob" (urlquery $.Ref) $.TreePath .Name }}
68 {{ $icon = "folder-input" }}
69 {{ $iconStyle = "size-4" }}
70 {{ end }}
71
72 {{ if .IsFile }}
73 {{ $link = printf "/%s/%s/%s/%s/%s" $.RepoInfo.FullName "blob" (urlquery $.Ref) $.TreePath .Name }}
74 {{ $icon = "file" }}
75 {{ $iconStyle = "size-4" }}
76 {{ end }}
77
78 <a href="{{ $link }}" class="{{ $linkstyle }}">
79 <div class="flex items-center gap-2">
80 {{ i $icon $iconStyle "flex-shrink-0" }}
81 <span class="truncate">{{ .Name }}</span>
82 </div>
83 </a>
84 </div>
85
86 <div class="col-span-0 md:col-span-6 hidden md:block overflow-hidden">
87 {{ with .LastCommit }}
88 <a href="/{{ $.RepoInfo.FullName }}/commit/{{ .Hash }}" class="text-gray-500 dark:text-gray-400 block truncate">{{ .Message }}</a>
89 {{ end }}
90 </div>
91
92 <div class="col-span-4 md:col-span-2 text-sm text-right">
93 {{ with .LastCommit }}
94 <a href="/{{ $.RepoInfo.FullName }}/commit/{{ .Hash }}" class="text-gray-500 dark:text-gray-400">{{ template "repo/fragments/time" .When }}</a>
95 {{ end }}
96 </div>
97 </div>
98 {{ end }}
99
100 </div>
101</main>
102{{end}}
103
104{{ define "repoAfter" }}
105 {{- if or .HTMLReadme .Readme -}}
106 {{ template "repo/fragments/readme" . }}
107 {{- end -}}
108{{ end }}