1{{ define "title" }}
2 branches · {{ .RepoInfo.FullName }}
3{{ end }}
4
5{{ define "extrameta" }}
6 {{ $title := printf "branches · %s" .RepoInfo.FullName }}
7 {{ $url := printf "https://tangled.sh/%s/branches" .RepoInfo.FullName }}
8
9 {{ template "repo/fragments/og" (dict "RepoInfo" .RepoInfo "Title" $title "Url" $url) }}
10{{ end }}
11
12{{ define "repoContent" }}
13<section id="branches-table" class="overflow-x-auto">
14 <h2 class="font-bold text-sm mb-4 uppercase dark:text-white">
15 Branches
16 </h2>
17
18 <!-- desktop view (hidden on small screens) -->
19 <table class="w-full border-collapse hidden md:table">
20 <thead>
21 <tr>
22 <th class="py-2 text-sm text-left text-gray-700 dark:text-gray-300 uppercase font-bold">Name</th>
23 <th class="py-2 text-sm text-left text-gray-700 dark:text-gray-300 uppercase font-bold">Commit</th>
24 <th class="py-2 text-sm text-left text-gray-700 dark:text-gray-300 uppercase font-bold">Message</th>
25 <th class="py-2 text-sm text-left text-gray-700 dark:text-gray-300 uppercase font-bold">Date</th>
26 </tr>
27 </thead>
28 <tbody>
29 {{ range $index, $branch := .Branches }}
30 <tr class="{{ if ne $index (sub (len $.Branches) 1) }}border-b border-gray-200 dark:border-gray-700{{ end }}">
31 <td class="py-3 whitespace-nowrap">
32 <a href="/{{ $.RepoInfo.FullName }}/tree/{{ .Name | urlquery }}" class="no-underline hover:underline flex items-center gap-2">
33 <span class="dark:text-white">
34 {{ .Name }}
35 </span>
36 {{ if .IsDefault }}
37 <span class="
38 text-sm rounded
39 bg-gray-100 dark:bg-gray-700 text-black dark:text-white
40 font-mono
41 px-2 mx-1/2
42 inline-flex items-center
43 ">
44 default
45 </span>
46 {{ end }}
47 </a>
48 </td>
49 <td class="py-3 whitespace-nowrap">
50 {{ if .Commit }}
51 <a href="/{{ $.RepoInfo.FullName }}/commits/{{ .Name | urlquery }}" class="font-mono text-gray-700 dark:text-gray-300 no-underline hover:underline">{{ slice .Commit.Hash.String 0 8 }}</a>
52 {{ end }}
53 </td>
54 <td class="py-3 whitespace-nowrap">
55 {{ if .Commit }}
56 {{ $messageParts := splitN .Commit.Message "\n\n" 2 }}
57 <span class="text-gray-700 dark:text-gray-300">{{ index $messageParts 0 }}</span>
58 {{ end }}
59 </td>
60 <td class="py-3 whitespace-nowrap text-gray-500 dark:text-gray-400">
61 {{ if .Commit }}
62 {{ template "repo/fragments/time" .Commit.Committer.When }}
63 {{ end }}
64 </td>
65 </tr>
66 {{ end }}
67 </tbody>
68 </table>
69
70 <!-- mobile view (visible only on small screens) -->
71 <div class="md:hidden">
72 {{ range $index, $branch := .Branches }}
73 <div class="relative p-2 {{ if ne $index (sub (len $.Branches) 1) }}border-b border-gray-200 dark:border-gray-700{{ end }}">
74 <div class="flex items-center justify-between">
75 <a href="/{{ $.RepoInfo.FullName }}/tree/{{ .Name | urlquery }}" class="no-underline hover:underline flex items-center gap-2">
76 <span class="dark:text-white font-medium">
77 {{ .Name }}
78 </span>
79 {{ if .IsDefault }}
80 <span class="
81 text-xs rounded
82 bg-gray-100 dark:bg-gray-700 text-black dark:text-white
83 font-mono
84 px-2
85 inline-flex items-center
86 ">
87 default
88 </span>
89 {{ end }}
90 </a>
91 </div>
92
93 {{ if .Commit }}
94 <div class="text-xs text-gray-500 dark:text-gray-400 mt-1 flex items-center">
95 <span class="font-mono">
96 <a href="/{{ $.RepoInfo.FullName }}/commits/{{ .Name | urlquery }}" class="text-gray-500 dark:text-gray-400 no-underline hover:underline">
97 {{ slice .Commit.Hash.String 0 8 }}
98 </a>
99 </span>
100 <div class="inline-block px-1 select-none after:content-['·']"></div>
101 {{ template "repo/fragments/time" .Commit.Committer.When }}
102 </div>
103 {{ end }}
104 </div>
105 {{ end }}
106 </div>
107</section>
108{{ end }}