this repo has no description
1{{ define "title" }}commits · {{ .RepoInfo.FullName }}{{ end }}
2
3{{ define "extrameta" }}
4 {{ $title := printf "commits · %s" .RepoInfo.FullName }}
5 {{ $url := printf "https://tangled.sh/%s/commits" .RepoInfo.FullName }}
6
7 {{ template "repo/fragments/og" (dict "RepoInfo" .RepoInfo "Title" $title "Url" $url) }}
8{{ end }}
9
10{{ define "repoContent" }}
11<section id="commit-table" class="overflow-x-auto">
12 <h2 class="font-bold text-sm mb-4 uppercase dark:text-white">
13 commits
14 </h2>
15
16 <!-- desktop view (hidden on small screens) -->
17 <table class="w-full border-collapse hidden md:table">
18 <thead>
19 <tr>
20 <th class="py-2 text-sm text-left text-gray-700 dark:text-gray-300 uppercase font-bold">Author</th>
21 <th class="py-2 text-sm text-left text-gray-700 dark:text-gray-300 uppercase font-bold">Commit</th>
22 <th class="py-2 text-sm text-left text-gray-700 dark:text-gray-300 uppercase font-bold">Message</th>
23 <th class="py-2 text-sm text-left text-gray-700 dark:text-gray-300 uppercase font-bold">Date</th>
24 </tr>
25 </thead>
26 <tbody>
27 {{ range $index, $commit := .Commits }}
28 {{ $messageParts := splitN $commit.Message "\n\n" 2 }}
29 <tr class="{{ if ne $index (sub (len $.Commits) 1) }}border-b border-gray-200 dark:border-gray-700{{ end }}">
30 <td class=" py-3 align-top">
31 {{ $didOrHandle := index $.EmailToDidOrHandle $commit.Author.Email }}
32 {{ if $didOrHandle }}
33 <a href="/{{ $didOrHandle }}" class="text-gray-700 dark:text-gray-300 no-underline hover:underline">{{ $didOrHandle }}</a>
34 {{ else }}
35 <a href="mailto:{{ $commit.Author.Email }}" class="text-gray-700 dark:text-gray-300 no-underline hover:underline">{{ $commit.Author.Name }}</a>
36 {{ end }}
37 </td>
38 <td class="py-3 align-top font-mono flex items-center">
39 {{ $verified := $.VerifiedCommits.IsVerified $commit.Hash.String }}
40 {{ $hashStyle := "text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-900" }}
41 {{ if $verified }}
42 {{ $hashStyle = "bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200 px-2 rounded" }}
43 {{ end }}
44 <a href="/{{ $.RepoInfo.FullName }}/commit/{{ $commit.Hash.String }}" class="no-underline hover:underline {{ $hashStyle }} px-2 py-1/2 rounded flex items-center gap-2">
45 {{ slice $commit.Hash.String 0 8 }}
46 {{ if $verified }}
47 {{ i "shield-check" "w-4 h-4" }}
48 {{ end }}
49 </a>
50 <div class="{{ if not $verified }} ml-6 {{ end }}inline-flex">
51 <button class="p-1 mx-1 hover:bg-gray-100 dark:hover:bg-gray-700 rounded"
52 title="Copy SHA"
53 onclick="navigator.clipboard.writeText('{{ $commit.Hash.String }}'); this.innerHTML=`{{ i "copy-check" "w-4 h-4" }}`; setTimeout(() => this.innerHTML=`{{ i "copy" "w-4 h-4" }}`, 1500)">
54 {{ i "copy" "w-4 h-4" }}
55 </button>
56 <a href="/{{ $.RepoInfo.FullName }}/tree/{{ $commit.Hash.String }}" class="p-1 mx-1 hover:bg-gray-100 dark:hover:bg-gray-700 rounded" title="Browse repository at this commit">
57 {{ i "folder-code" "w-4 h-4" }}
58 </a>
59 </div>
60 </td>
61 <td class=" py-3 align-top">
62 <div>
63 <div class="flex items-center justify-start">
64 <a href="/{{ $.RepoInfo.FullName }}/commit/{{ $commit.Hash.String }}" class="dark:text-white no-underline hover:underline">{{ index $messageParts 0 }}</a>
65 {{ if gt (len $messageParts) 1 }}
66 <button class="ml-2 py-1/2 px-1 bg-gray-200 hover:bg-gray-400 dark:bg-gray-700 dark:hover:bg-gray-600 rounded" hx-on:click="this.parentElement.nextElementSibling.classList.toggle('hidden')">{{ i "ellipsis" "w-3 h-3" }}</button>
67 {{ end }}
68
69
70 {{ if index $.TagMap $commit.Hash.String }}
71 {{ range $tag := index $.TagMap $commit.Hash.String }}
72 <span class="ml-2 text-xs rounded bg-gray-100 dark:bg-gray-700 text-black dark:text-white font-mono px-2 inline-flex items-center">
73 {{ $tag }}
74 </span>
75 {{ end }}
76 {{ end }}
77
78 </div>
79
80 {{ if gt (len $messageParts) 1 }}
81 <p class="hidden mt-1 text-sm text-gray-600 dark:text-gray-400">{{ nl2br (index $messageParts 1) }}</p>
82 {{ end }}
83 </td>
84 <td class=" py-3 align-top text-gray-500 dark:text-gray-400">{{ timeFmt $commit.Committer.When }}</td>
85 </tr>
86 {{ end }}
87 </tbody>
88 </table>
89
90 <!-- mobile view (visible only on small screens) -->
91 <div class="md:hidden">
92 {{ range $index, $commit := .Commits }}
93 <div class="relative p-2 mb-2 {{ if ne $index (sub (len $.Commits) 1) }}border-b border-gray-200 dark:border-gray-700{{ end }}">
94 <div id="commit-message">
95 {{ $messageParts := splitN $commit.Message "\n\n" 2 }}
96 <div class="text-base cursor-pointer">
97 <div>
98 <div class="flex items-center justify-between">
99 <div class="flex-1">
100 <div class="inline">
101 <a href="/{{ $.RepoInfo.FullName }}/commit/{{ $commit.Hash.String }}"
102 class="inline no-underline hover:underline dark:text-white">
103 {{ index $messageParts 0 }}
104 </a>
105 {{ if gt (len $messageParts) 1 }}
106 <button
107 class="py-1/2 px-1 bg-gray-200 hover:bg-gray-400 rounded dark:bg-gray-700 dark:hover:bg-gray-600 ml-2"
108 hx-on:click="this.parentElement.nextElementSibling.classList.toggle('hidden')">
109 {{ i "ellipsis" "w-3 h-3" }}
110 </button>
111 {{ end }}
112
113 {{ if index $.TagMap $commit.Hash.String }}
114 {{ range $tag := index $.TagMap $commit.Hash.String }}
115 <span class="ml-2 text-xs rounded bg-gray-100 dark:bg-gray-700 text-black dark:text-white font-mono px-2 inline-flex items-center">
116 {{ $tag }}
117 </span>
118 {{ end }}
119 {{ end }}
120 </div>
121
122 {{ if gt (len $messageParts) 1 }}
123 <p class="hidden mt-1 text-sm cursor-text pb-2 dark:text-gray-300">
124 {{ nl2br (index $messageParts 1) }}
125 </p>
126 {{ end }}
127 </div>
128 <a href="/{{ $.RepoInfo.FullName }}/tree/{{ $commit.Hash.String }}"
129 class="p-1 mr-1 hover:bg-gray-100 dark:hover:bg-gray-700 rounded"
130 title="Browse repository at this commit">
131 {{ i "folder-code" "w-4 h-4" }}
132 </a>
133 </div>
134 </div>
135 </div>
136 </div>
137
138 <div class="text-xs mt-2 text-gray-500 dark:text-gray-400 flex items-center">
139 {{ $verified := $.VerifiedCommits.IsVerified $commit.Hash.String }}
140 {{ $hashStyle := "text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-900" }}
141 {{ if $verified }}
142 {{ $hashStyle = "bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200 px-2 rounded" }}
143 {{ end }}
144 <span class="font-mono">
145 <a href="/{{ $.RepoInfo.FullName }}/commit/{{ $commit.Hash.String }}"
146 class="no-underline hover:underline {{ $hashStyle }} px-2 py-1 rounded flex items-center gap-2">
147 {{ slice $commit.Hash.String 0 8 }}
148 {{ if $verified }}
149 {{ i "shield-check" "w-3 h-3" }}
150 {{ end }}
151 </a>
152 </span>
153 <span class="mx-2 before:content-['·'] before:select-none"></span>
154 <span>
155 {{ $didOrHandle := index $.EmailToDidOrHandle $commit.Author.Email }}
156 <a href="{{ if $didOrHandle }}/{{ $didOrHandle }}{{ else }}mailto:{{ $commit.Author.Email }}{{ end }}"
157 class="text-gray-500 dark:text-gray-400 no-underline hover:underline">
158 {{ if $didOrHandle }}{{ $didOrHandle }}{{ else }}{{ $commit.Author.Name }}{{ end }}
159 </a>
160 </span>
161 <div class="inline-block px-1 select-none after:content-['·']"></div>
162 <span>{{ shortTimeFmt $commit.Committer.When }}</span>
163 </div>
164 </div>
165 {{ end }}
166 </div>
167</section>
168
169{{ end }}
170
171{{ define "repoAfter" }}
172 {{ $commits_len := len .Commits }}
173 <div class="flex justify-end mt-4 gap-2">
174 {{ if gt .Page 1 }}<a class="btn flex items-center gap-2 no-underline hover:no-underline dark:text-white dark:hover:bg-gray-700" hx-boost="true" onclick="window.location.href = window.location.pathname + '?page={{ sub .Page 1 }}'">{{ i "chevron-left" "w-4 h-4" }} previous</a>{{ else }}<div></div>{{ end }}
175 {{ if eq $commits_len 60 }}<a class="btn flex items-center gap-2 no-underline hover:no-underline dark:text-white dark:hover:bg-gray-700" hx-boost="true" onclick="window.location.href = window.location.pathname + '?page={{ add .Page 1 }}'">next {{ i "chevron-right" "w-4 h-4" }}</a>{{ end }}
176 </div>
177{{ end }}