Monorepo for Tangled
at 3b646dcb2fb536a3c2a7f9b66cf0d93aa3194d33 139 lines 5.3 kB view raw
1{{ define "title" }} 2 {{ $messageParts := splitN .Diff.Commit.Message "\n\n" 2 }} 3 {{ index $messageParts 0 }} &middot; {{ .RepoInfo.FullName }}@{{ slice .Diff.Commit.This 0 7 }} 4{{ end }} 5 6{{ define "extrameta" }} 7 {{ $messageParts := splitN .Diff.Commit.Message "\n\n" 2 }} 8 {{ $title := printf "%s &middot; %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-wrap items-center space-x-2"> 32 <p class="flex flex-wrap items-center gap-1 text-sm text-gray-500 dark:text-gray-300"> 33 {{ template "attribution" . }} 34 35 <span class="px-1 select-none before:content-['\00B7']"></span> 36 {{ template "repo/fragments/time" $commit.Committer.When }} 37 <span class="px-1 select-none before:content-['\00B7']"></span> 38 39 <a href="/{{ $repo }}/commit/{{ $commit.This }}" class="no-underline hover:underline text-gray-500 dark:text-gray-300">{{ slice $commit.This 0 8 }}</a> 40 41 {{ if $commit.Parent }} 42 {{ i "arrow-left" "w-3 h-3 mx-1" }} 43 <a href="/{{ $repo }}/commit/{{ $commit.Parent }}" class="no-underline hover:underline text-gray-500 dark:text-gray-300">{{ slice $commit.Parent 0 8 }}</a> 44 {{ end }} 45 </p> 46 47 {{ if .VerifiedCommit.IsVerified $commit.This }} 48 <div class="group relative inline-block text-sm"> 49 <div class="bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200 px-2 py-1 rounded cursor-pointer"> 50 <div class="flex items-center gap-2"> 51 {{ i "shield-check" "w-4 h-4" }} 52 verified 53 </div> 54 </div> 55 <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"> 56 <div class="mb-1">This commit was signed with the committer's <span class="text-green-600 font-semibold">known signature</span>.</div> 57 <div class="flex items-center gap-2 my-2"> 58 {{ i "user" "w-4 h-4" }} 59 {{ $committerDid := index $.EmailToDid $commit.Committer.Email }} 60 {{ template "user/fragments/picHandleLink" $committerDid }} 61 </div> 62 <div class="my-1 pt-2 text-xs border-t border-gray-200 dark:border-gray-700"> 63 <div class="text-gray-600 dark:text-gray-300">SSH Key Fingerprint:</div> 64 <div class="break-all">{{ .VerifiedCommit.Fingerprint $commit.This }}</div> 65 </div> 66 </div> 67 </div> 68 {{ end }} 69 70 <div class="text-sm"> 71 {{ if $.Pipeline }} 72 {{ template "repo/pipelines/fragments/pipelineSymbolLong" (dict "Pipeline" $.Pipeline "RepoInfo" $.RepoInfo) }} 73 {{ end }} 74 </div> 75 </div> 76 77</section> 78{{end}} 79 80{{ define "attribution" }} 81 {{ $commit := .Diff.Commit }} 82 {{ $showCommitter := true }} 83 {{ if eq $commit.Author.Email $commit.Committer.Email }} 84 {{ $showCommitter = false }} 85 {{ end }} 86 87 {{ if $showCommitter }} 88 authored by {{ template "attributedUser" (list $commit.Author.Email $commit.Author.Name $.EmailToDid) }} 89 {{ range $commit.CoAuthors }} 90 {{ template "attributedUser" (list .Email .Name $.EmailToDid) }} 91 {{ end }} 92 and committed by {{ template "attributedUser" (list $commit.Committer.Email $commit.Committer.Name $.EmailToDid) }} 93 {{ else }} 94 {{ template "attributedUser" (list $commit.Author.Email $commit.Author.Name $.EmailToDid )}} 95 {{ end }} 96{{ end }} 97 98{{ define "attributedUser" }} 99 {{ $email := index . 0 }} 100 {{ $name := index . 1 }} 101 {{ $map := index . 2 }} 102 {{ $did := index $map $email }} 103 104 {{ if $did }} 105 {{ template "user/fragments/picHandleLink" $did }} 106 {{ else }} 107 <span class="flex items-center gap-1"> 108 {{ placeholderAvatar "tiny" }} 109 <a href="mailto:{{ $email }}" class="no-underline hover:underline text-gray-500 dark:text-gray-300">{{ $name }}</a> 110 </span> 111 {{ end }} 112{{ end }} 113 114{{ define "topbarLayout" }} 115 <header class="col-span-full" style="z-index: 20;"> 116 {{ template "layouts/fragments/topbar" . }} 117 </header> 118{{ end }} 119 120{{ define "mainLayout" }} 121 <div class="px-1 flex-grow col-span-full flex flex-col gap-4"> 122 {{ block "contentLayout" . }} 123 {{ block "content" . }}{{ end }} 124 {{ end }} 125 126 {{ block "contentAfter" . }}{{ end }} 127 </div> 128{{ end }} 129 130{{ define "footerLayout" }} 131 <footer class="col-span-full mt-12"> 132 {{ template "layouts/fragments/footer" . }} 133 </footer> 134{{ end }} 135 136{{ define "contentAfter" }} 137 {{ template "repo/fragments/diff" (list .Diff .DiffOpts) }} 138{{end}} 139