forked from tangled.org/core
Monorepo for Tangled — https://tangled.org
1{{ define "title" }} commit {{ .Diff.Commit.This }} &middot; {{ .RepoInfo.FullName }} {{ end }} 2 3{{ define "extrameta" }} 4 {{ $title := printf "commit %s &middot; %s" .Diff.Commit.This .RepoInfo.FullName }} 5 {{ $url := printf "https://tangled.sh/%s/commit/%s" .RepoInfo.FullName .Diff.Commit.This }} 6 7 {{ template "repo/fragments/og" (dict "RepoInfo" .RepoInfo "Title" $title "Url" $url) }} 8{{ end }} 9 10 11{{ define "repoContent" }} 12 13{{ $repo := .RepoInfo.FullName }} 14{{ $commit := .Diff.Commit }} 15 16<section class="commit dark:text-white"> 17 <div id="commit-message"> 18 {{ $messageParts := splitN $commit.Message "\n\n" 2 }} 19 <div> 20 <p class="pb-2">{{ index $messageParts 0 }}</p> 21 {{ if gt (len $messageParts) 1 }} 22 <p class="mt-1 cursor-text pb-2 text-sm">{{ nl2br (index $messageParts 1) }}</p> 23 {{ end }} 24 </div> 25 </div> 26 27 <div class="flex items-center space-x-2"> 28 <p class="text-sm text-gray-500 dark:text-gray-300"> 29 {{ $didOrHandle := index $.EmailToDidOrHandle $commit.Author.Email }} 30 31 {{ if $didOrHandle }} 32 <a href="/{{ $didOrHandle }}" class="no-underline hover:underline text-gray-500 dark:text-gray-300">{{ $didOrHandle }}</a> 33 {{ else }} 34 <a href="mailto:{{ $commit.Author.Email }}" class="no-underline hover:underline text-gray-500 dark:text-gray-300">{{ $commit.Author.Name }}</a> 35 {{ end }} 36 <span class="px-1 select-none before:content-['\00B7']"></span> 37 {{ template "repo/fragments/time" $commit.Author.When }} 38 <span class="px-1 select-none before:content-['\00B7']"></span> 39 </p> 40 41 <p class="flex items-center text-sm text-gray-500 dark:text-gray-300"> 42 <a href="/{{ $repo }}/commit/{{ $commit.This }}" class="no-underline hover:underline text-gray-500 dark:text-gray-300">{{ slice $commit.This 0 8 }}</a> 43 {{ if $commit.Parent }} 44 {{ i "arrow-left" "w-3 h-3 mx-1" }} 45 <a href="/{{ $repo }}/commit/{{ $commit.Parent }}" class="no-underline hover:underline text-gray-500 dark:text-gray-300">{{ slice $commit.Parent 0 8 }}</a> 46 {{ end }} 47 </p> 48 49 {{ if .VerifiedCommit.IsVerified $commit.This }} 50 <div class="group relative inline-block text-sm"> 51 <div class="bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200 px-2 py-1 rounded cursor-pointer"> 52 <div class="flex items-center gap-2"> 53 {{ i "shield-check" "w-4 h-4" }} 54 verified 55 </div> 56 </div> 57 <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"> 58 <div class="mb-1">This commit was signed with the committer's <span class="text-green-600 font-semibold">known signature</span>.</div> 59 <div class="flex items-center gap-2 my-2"> 60 {{ i "user" "w-4 h-4" }} 61 {{ $committerDidOrHandle := index $.EmailToDidOrHandle $commit.Committer.Email }} 62 <a href="/{{ $committerDidOrHandle }}">{{ template "user/fragments/picHandleLink" $committerDidOrHandle }}</a> 63 </div> 64 <div class="my-1 pt-2 text-xs border-t"> 65 <div class="text-gray-600 dark:text-gray-300">SSH Key Fingerprint:</div> 66 <div class="break-all">{{ .VerifiedCommit.Fingerprint $commit.This }}</div> 67 </div> 68 </div> 69 </div> 70 {{ end }} 71 72 <div class="text-sm"> 73 {{ if $.Pipeline }} 74 {{ template "repo/pipelines/fragments/pipelineSymbolLong" (dict "Pipeline" $.Pipeline "RepoInfo" $.RepoInfo) }} 75 {{ end }} 76 </div> 77 </div> 78 79</section> 80{{end}} 81 82{{ define "topbarLayout" }} 83 <header class="px-1 col-span-full" style="z-index: 20;"> 84 {{ template "layouts/topbar" . }} 85 </header> 86{{ end }} 87 88{{ define "mainLayout" }} 89 <div class="px-1 col-span-full flex flex-col gap-4"> 90 {{ block "contentLayout" . }} 91 {{ block "content" . }}{{ end }} 92 {{ end }} 93 94 {{ block "contentAfterLayout" . }} 95 <div class="flex-grow grid grid-cols-1 md:grid-cols-12 gap-4"> 96 <div class="flex flex-col gap-4 col-span-1 md:col-span-2"> 97 {{ block "contentAfterLeft" . }} {{ end }} 98 </div> 99 <main class="col-span-1 md:col-span-10"> 100 {{ block "contentAfter" . }}{{ end }} 101 </main> 102 </div> 103 {{ end }} 104 </div> 105{{ end }} 106 107{{ define "footerLayout" }} 108 <footer class="px-1 col-span-full mt-12"> 109 {{ template "layouts/footer" . }} 110 </footer> 111{{ end }} 112 113{{ define "contentAfter" }} 114 {{ template "repo/fragments/diff" (list .RepoInfo.FullName .Diff .DiffOpts) }} 115{{end}} 116 117{{ define "contentAfterLeft" }} 118 <div class="flex flex-col gap-4 col-span-1 md:col-span-2"> 119 {{ template "repo/fragments/diffOpts" .DiffOpts }} 120 </div> 121 <div class="sticky top-0 flex-grow max-h-screen"> 122 {{ template "repo/fragments/diffChangedFiles" .Diff }} 123 </div> 124{{end}}