Something went wrong. Try again.
Monorepo for Tangled
Something went wrong. Try again.
5.6 kB · 149 lines
HTML
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150{{ define "title" }} commit {{ .Diff.Commit.This }} · {{ .RepoInfo.FullName }} {{ end }}
{{ define "extrameta" }} {{ $title := printf "commit %s · %s" .Diff.Commit.This .RepoInfo.FullName }} {{ $url := printf "https://tangled.org/%s/commit/%s" .RepoInfo.FullName .Diff.Commit.This }}
{{ template "repo/fragments/og" (dict "RepoInfo" .RepoInfo "Title" $title "Url" $url) }}{{ end }}
{{ define "repoContent" }}
{{ $repo := .RepoInfo.FullName }}{{ $commit := .Diff.Commit }}
<section class="commit dark:text-white"> <div id="commit-message"> {{ $messageParts := splitN $commit.Message "\n\n" 2 }} <div> <p class="pb-2">{{ index $messageParts 0 }}</p> {{ if gt (len $messageParts) 1 }} <p class="mt-1 cursor-text pb-2 text-sm">{{ nl2br (index $messageParts 1) }}</p> {{ end }} </div> </div>
<div class="flex flex-wrap items-center space-x-2"> <p class="flex flex-wrap items-center gap-1 text-sm text-gray-500 dark:text-gray-300"> {{ template "attribution" . }}
<span class="px-1 select-none before:content-['\00B7']"></span> {{ template "repo/fragments/time" $commit.Committer.When }} <span class="px-1 select-none before:content-['\00B7']"></span>
<a href="/{{ $repo }}/commit/{{ $commit.This }}" class="no-underline hover:underline text-gray-500 dark:text-gray-300">{{ slice $commit.This 0 8 }}</a>
{{ if $commit.Parent }} {{ i "arrow-left" "w-3 h-3 mx-1" }} <a href="/{{ $repo }}/commit/{{ $commit.Parent }}" class="no-underline hover:underline text-gray-500 dark:text-gray-300">{{ slice $commit.Parent 0 8 }}</a> {{ end }} </p>
{{ if .VerifiedCommit.IsVerified $commit.This }} <div class="group relative inline-block text-sm"> <div class="bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200 px-2 py-1 rounded cursor-pointer"> <div class="flex items-center gap-2"> {{ i "shield-check" "w-4 h-4" }} verified </div> </div> <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"> <div class="mb-1">This commit was signed with the committer's <span class="text-green-600 font-semibold">known signature</span>.</div> <div class="flex items-center gap-2 my-2"> {{ i "user" "w-4 h-4" }} {{ $committerDid := index $.EmailToDid $commit.Committer.Email }} {{ template "user/fragments/picHandleLink" $committerDid }} </div> <div class="my-1 pt-2 text-xs border-t border-gray-200 dark:border-gray-700"> <div class="text-gray-600 dark:text-gray-300">SSH Key Fingerprint:</div> <div class="break-all">{{ .VerifiedCommit.Fingerprint $commit.This }}</div> </div> </div> </div> {{ end }}
<div class="text-sm"> {{ if $.Pipeline }} {{ template "repo/pipelines/fragments/pipelineSymbolLong" (dict "Pipeline" $.Pipeline "RepoInfo" $.RepoInfo) }} {{ end }} </div> </div>
</section>{{end}}
{{ define "attribution" }} {{ $commit := .Diff.Commit }} {{ $showCommitter := true }} {{ if eq $commit.Author.Email $commit.Committer.Email }} {{ $showCommitter = false }} {{ end }}
{{ if $showCommitter }} authored by {{ template "attributedUser" (list $commit.Author.Email $commit.Author.Name $.EmailToDid) }} {{ range $commit.CoAuthors }} {{ template "attributedUser" (list .Email .Name $.EmailToDid) }} {{ end }} and committed by {{ template "attributedUser" (list $commit.Committer.Email $commit.Committer.Name $.EmailToDid) }} {{ else }} {{ template "attributedUser" (list $commit.Author.Email $commit.Author.Name $.EmailToDid )}} {{ end }}{{ end }}
{{ define "attributedUser" }} {{ $email := index . 0 }} {{ $name := index . 1 }} {{ $map := index . 2 }} {{ $did := index $map $email }}
{{ if $did }} {{ template "user/fragments/picHandleLink" $did }} {{ else }} <a href="mailto:{{ $email }}" class="no-underline hover:underline text-gray-500 dark:text-gray-300">{{ $name }}</a> {{ end }}{{ end }}
{{ define "topbarLayout" }} <header class="col-span-full" style="z-index: 20;"> {{ template "layouts/fragments/topbar" . }} </header>{{ end }}
{{ define "mainLayout" }} <div class="px-1 flex-grow col-span-full flex flex-col gap-4"> {{ block "contentLayout" . }} {{ block "content" . }}{{ end }} {{ end }}
{{ block "contentAfterLayout" . }} <div class="flex-grow grid grid-cols-1 md:grid-cols-12 gap-4"> <div class="flex flex-col gap-4 col-span-1 md:col-span-2"> {{ block "contentAfterLeft" . }} {{ end }} </div> <main class="col-span-1 md:col-span-10"> {{ block "contentAfter" . }}{{ end }} </main> </div> {{ end }} </div>{{ end }}
{{ define "footerLayout" }} <footer class="col-span-full mt-12"> {{ template "layouts/fragments/footer" . }} </footer>{{ end }}
{{ define "contentAfter" }} {{ template "repo/fragments/diff" (list .Diff .DiffOpts) }}{{end}}
{{ define "contentAfterLeft" }} <div class="flex flex-col gap-4 col-span-1 md:col-span-2"> {{ template "repo/fragments/diffOpts" .DiffOpts }} </div> <div class="sticky top-0 flex-grow max-h-screen overflow-y-auto"> {{ template "repo/fragments/diffChangedFiles" .Diff }} </div>{{end}}