Monorepo for Tangled
tangled.org
1{{ define "title" }}
2 {{ $messageParts := splitN .Diff.Commit.Message "\n\n" 2 }}
3 {{ index $messageParts 0 }} · {{ .RepoInfo.FullName }}@{{ slice .Diff.Commit.This 0 7 }} · Tangled
4{{ end }}
5
6{{ define "extrameta" }}
7 {{ $messageParts := splitN .Diff.Commit.Message "\n\n" 2 }}
8 {{ $title := printf "%s · %s@%s" (index $messageParts 0) .RepoInfo.FullName (slice .Diff.Commit.This 0 7) }}
9 {{ $url := printf "https://tangled.org/%s/commit/%s" .RepoInfo.FullName .Diff.Commit.This }}
10
11 {{ template "repo/fragments/og" (dict "RepoInfo" .RepoInfo "Title" $title "Url" $url) }}
12{{ end }}
13
14
15{{ define "repoContent" }}
16
17{{ $repo := .RepoInfo.FullName }}
18{{ $commit := .Diff.Commit }}
19
20<section class="commit dark:text-white">
21 <div id="commit-message">
22 {{ $messageParts := splitN $commit.Message "\n\n" 2 }}
23 <div>
24 <p class="pb-2">{{ index $messageParts 0 }}</p>
25 {{ if gt (len $messageParts) 1 }}
26 <p class="mt-1 cursor-text pb-2 text-sm">{{ nl2br (index $messageParts 1) }}</p>
27 {{ end }}
28 </div>
29 </div>
30
31 <div class="flex flex-col gap-2 text-sm pt-4">
32 {{ $showCommitter := ne $commit.Author.Email $commit.Committer.Email }}
33 <div class="flex flex-col gap-1 font-mono text-gray-500 dark:text-gray-300">
34 <span class="inline-flex items-center flex-wrap">
35 <span class="w-24 text-gray-400 dark:text-gray-500 select-none">author</span>
36 {{ template "attributedUser" (list $commit.Author.Email $commit.Author.Name $.EmailToDid) }}
37 </span>
38
39 {{ range $commit.CoAuthors }}
40 <span class="inline-flex items-center flex-wrap">
41 <span class="w-24 text-gray-400 dark:text-gray-500 select-none">co-author</span>
42 {{ template "attributedUser" (list .Email .Name $.EmailToDid) }}
43 </span>
44 {{ end }}
45
46 {{ if $showCommitter }}
47 <span class="inline-flex items-center flex-wrap">
48 <span class="w-24 text-gray-400 dark:text-gray-500 select-none">committer</span>
49 {{ template "attributedUser" (list $commit.Committer.Email $commit.Committer.Name $.EmailToDid) }}
50 </span>
51 {{ end }}
52
53 <span class="inline-flex items-center flex-wrap">
54 <span class="w-24 text-gray-400 dark:text-gray-500 select-none">date</span>
55 <span class="inline-flex items-center flex-wrap gap-1">
56 {{ template "repo/fragments/time" $commit.Committer.When }}
57 <span class="text-gray-500 dark:text-gray-400">({{ $commit.Committer.When | longTimeFmt }})</span>
58 </span>
59 </span>
60
61 <span class="inline-flex items-center flex-wrap">
62 <span class="w-24 text-gray-400 dark:text-gray-500 select-none">commit</span>
63 <a href="/{{ $repo }}/commit/{{ $commit.This }}" class="no-underline hover:underline break-all">
64 <span class="md:hidden">{{ shortId $commit.This }}</span>
65 <span class="hidden md:inline">{{ $commit.This }}</span>
66 </a>
67 </span>
68
69 {{ if $commit.Parent }}
70 <span class="inline-flex items-center flex-wrap">
71 <span class="w-24 text-gray-400 dark:text-gray-500 select-none">parent</span>
72 <a href="/{{ $repo }}/commit/{{ $commit.Parent }}" class="no-underline hover:underline break-all">
73 <span class="md:hidden">{{ shortId $commit.Parent }}</span>
74 <span class="hidden md:inline">{{ $commit.Parent }}</span>
75 </a>
76 </span>
77 {{ end }}
78
79 {{ if $commit.ChangeId }}
80 <span class="inline-flex items-center flex-wrap">
81 <span class="w-24 text-gray-400 dark:text-gray-500 select-none">change-id</span>
82 <span class="break-all">
83 <span class="md:hidden">{{ shortId $commit.ChangeId }}</span>
84 <span class="hidden md:inline">{{ $commit.ChangeId }}</span>
85 </span>
86 </span>
87 {{ end }}
88 </div>
89
90 {{ if or (.VerifiedCommit.IsVerified $commit.This) $.Pipeline }}
91 <div class="flex flex-wrap items-center space-x-2">
92 {{ if .VerifiedCommit.IsVerified $commit.This }}
93 <div class="group relative inline-block text-sm">
94 <div class="bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200 px-2 py-1 rounded cursor-pointer">
95 <div class="flex items-center gap-2">
96 {{ i "shield-check" "w-4 h-4" }}
97 Verified
98 </div>
99 </div>
100 <div class="absolute z-[9999] hidden group-hover:block bg-white dark:bg-gray-900 text-sm text-black dark:text-white rounded-md shadow-md p-4 w-80 top-full mt-2">
101 <div class="mb-1">This commit was signed with the committer's <span class="text-green-600 font-semibold">known signature</span>.</div>
102 <div class="flex items-center gap-2 my-2">
103 {{ i "user" "w-4 h-4" }}
104 {{ $committerDid := index $.EmailToDid $commit.Committer.Email }}
105 {{ template "user/fragments/picHandleLink" $committerDid }}
106 </div>
107 <div class="my-1 pt-2 text-xs border-t border-gray-200 dark:border-gray-700">
108 <div class="text-gray-600 dark:text-gray-300">SSH Key Fingerprint:</div>
109 <div class="break-all">{{ .VerifiedCommit.Fingerprint $commit.This }}</div>
110 </div>
111 </div>
112 </div>
113 {{ end }}
114
115 <div class="text-sm">
116 {{ if $.Pipeline }}
117 {{ template "repo/pipelines/fragments/pipelineSymbolLong" (dict "Pipeline" $.Pipeline "RepoInfo" $.RepoInfo) }}
118 {{ end }}
119 </div>
120 </div>
121 {{ end }}
122 </div>
123
124</section>
125{{end}}
126
127{{ define "attributedUser" }}
128 {{ $email := index . 0 }}
129 {{ $name := index . 1 }}
130 {{ $map := index . 2 }}
131 {{ $did := index $map $email }}
132
133 {{ if $did }}
134 {{ template "user/fragments/picHandleLink" $did }}
135 {{ else }}
136 <span class="flex items-center gap-1">
137 {{ placeholderAvatar "tiny" }}
138 <a href="mailto:{{ $email }}" class="no-underline hover:underline text-gray-500 dark:text-gray-300">{{ $name }}</a>
139 </span>
140 {{ end }}
141{{ end }}
142
143{{ define "mainLayout" }}
144 <div class="px-1 flex-grow col-span-full flex flex-col gap-4">
145 {{ block "contentLayout" . }}
146 {{ block "content" . }}{{ end }}
147 {{ end }}
148
149 {{ block "contentAfter" . }}{{ end }}
150 </div>
151{{ end }}
152
153
154
155{{ define "contentAfter" }}
156 {{ template "repo/fragments/diff" (list .Diff .DiffOpts) }}
157{{end}}