A vibe coded tangled fork which supports pijul.
at master 153 lines 8.2 kB view raw
1{{ define "title" }}changes &middot; {{ .RepoInfo.FullName }}{{ end }} 2 3{{ define "extrameta" }} 4 {{ $title := printf "changes &middot; %s" .RepoInfo.FullName }} 5 {{ $url := printf "https://tangled.org/%s/changes" .RepoInfo.FullName }} 6 7 {{ template "repo/fragments/og" (dict "RepoInfo" .RepoInfo "Title" $title "Url" $url) }} 8{{ end }} 9 10{{ define "repoContent" }} 11<section id="change-table" class="overflow-x-auto"> 12 <h2 class="font-bold text-sm mb-4 uppercase dark:text-white"> 13 changes 14 </h2> 15 16 <!-- desktop view (hidden on small screens) --> 17 <div class="hidden md:flex md:flex-col divide-y divide-gray-200 dark:divide-gray-700"> 18 {{ $grid := "grid grid-cols-14 gap-4" }} 19 <div class="{{ $grid }}"> 20 <div class="py-2 text-sm text-left text-gray-700 dark:text-gray-300 uppercase font-bold col-span-3">Author</div> 21 <div class="py-2 text-sm text-left text-gray-700 dark:text-gray-300 uppercase font-bold col-span-3">Change</div> 22 <div class="py-2 text-sm text-left text-gray-700 dark:text-gray-300 uppercase font-bold col-span-6">Message</div> 23 <div class="py-2 text-sm text-left text-gray-700 dark:text-gray-300 uppercase font-bold col-span-2 justify-self-end">Date</div> 24 </div> 25 {{ range $index, $change := .Changes }} 26 {{ $messageParts := splitN $change.Message "\n\n" 2 }} 27 <div class="{{ $grid }} py-3"> 28 <div class="align-top col-span-3"> 29 {{ template "pijulAttribution" $change }} 30 </div> 31 <div class="align-top font-mono flex items-start col-span-3"> 32 {{ $hashStyle := "text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-900" }} 33 <a href="/{{ $.RepoInfo.FullName }}/change/{{ $change.Hash }}" class="no-underline hover:underline {{ $hashStyle }} px-2 py-1/2 rounded flex items-center gap-2"> 34 {{ slice $change.Hash 0 12 }} 35 </a> 36 <div class="ml-2 inline-flex"> 37 <button class="p-1 mx-1 hover:bg-gray-100 dark:hover:bg-gray-700 rounded" 38 title="Copy hash" 39 onclick="navigator.clipboard.writeText('{{ $change.Hash }}'); this.innerHTML=`{{ i "copy-check" "w-4 h-4" }}`; setTimeout(() => this.innerHTML=`{{ i "copy" "w-4 h-4" }}`, 1500)"> 40 {{ i "copy" "w-4 h-4" }} 41 </button> 42 </div> 43 </div> 44 <div class="align-top col-span-6"> 45 <div> 46 <a href="/{{ $.RepoInfo.FullName }}/change/{{ $change.Hash }}" class="dark:text-white no-underline hover:underline">{{ index $messageParts 0 }}</a> 47 48 {{ if gt (len $messageParts) 1 }} 49 <button class="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> 50 {{ end }} 51 52 {{ if $change.Dependencies }} 53 <span class="ml-2 text-xs text-gray-500" title="Depends on {{ len $change.Dependencies }} changes"> 54 {{ i "git-branch" "w-3 h-3 inline" }} {{ len $change.Dependencies }} 55 </span> 56 {{ end }} 57 </div> 58 59 {{ if gt (len $messageParts) 1 }} 60 <p class="hidden mt-1 text-sm text-gray-600 dark:text-gray-400">{{ nl2br (index $messageParts 1) }}</p> 61 {{ end }} 62 </div> 63 <div class="align-top justify-self-end text-gray-500 dark:text-gray-400 col-span-2"> 64 {{ if $change.HasTimestamp }} 65 {{ template "repo/fragments/shortTimeAgo" $change.Timestamp }} 66 {{ end }} 67 </div> 68 </div> 69 {{ end }} 70 </div> 71 72 <!-- mobile view (visible only on small screens) --> 73 <div class="md:hidden"> 74 {{ range $index, $change := .Changes }} 75 <div class="relative p-2 mb-2 {{ if ne $index (sub (len $.Changes) 1) }}border-b border-gray-200 dark:border-gray-700{{ end }}"> 76 <div id="change-message"> 77 {{ $messageParts := splitN $change.Message "\n\n" 2 }} 78 <div class="text-base cursor-pointer"> 79 <div class="flex items-center justify-between"> 80 <div class="flex-1"> 81 <div> 82 <a href="/{{ $.RepoInfo.FullName }}/change/{{ $change.Hash }}" 83 class="inline no-underline hover:underline dark:text-white"> 84 {{ index $messageParts 0 }} 85 </a> 86 {{ if gt (len $messageParts) 1 }} 87 <button 88 class="py-1/2 px-1 bg-gray-200 hover:bg-gray-400 rounded dark:bg-gray-700 dark:hover:bg-gray-600" 89 hx-on:click="this.parentElement.nextElementSibling.classList.toggle('hidden')"> 90 {{ i "ellipsis" "w-3 h-3" }} 91 </button> 92 {{ end }} 93 </div> 94 95 {{ if gt (len $messageParts) 1 }} 96 <p class="hidden mt-1 text-sm cursor-text pb-2 dark:text-gray-300"> 97 {{ nl2br (index $messageParts 1) }} 98 </p> 99 {{ end }} 100 </div> 101 </div> 102 </div> 103 </div> 104 105 <div class="text-xs mt-2 text-gray-500 dark:text-gray-400 flex items-center"> 106 {{ $hashStyle := "text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-900" }} 107 <span class="font-mono"> 108 <a href="/{{ $.RepoInfo.FullName }}/change/{{ $change.Hash }}" 109 class="no-underline hover:underline {{ $hashStyle }} px-2 py-1 rounded flex items-center gap-2"> 110 {{ slice $change.Hash 0 12 }} 111 </a> 112 </span> 113 <span class="mx-2 before:content-['·'] before:select-none"></span> 114 {{ template "pijulAttribution" $change }} 115 {{ if $change.HasTimestamp }} 116 <div class="inline-block px-1 select-none after:content-['·']"></div> 117 <span>{{ template "repo/fragments/shortTime" $change.Timestamp }}</span> 118 {{ end }} 119 </div> 120 </div> 121 {{ end }} 122 </div> 123</section> 124 125{{ end }} 126 127{{ define "pijulAttribution" }} 128 <span class="flex items-center gap-1"> 129 {{ if .Authors }} 130 {{ $author := index .Authors 0 }} 131 {{ if $author.Did }} 132 {{ template "user/fragments/picHandleLink" (deref $author.Did) }} 133 {{ else }} 134 {{ placeholderAvatar "tiny" }} 135 <span class="text-gray-700 dark:text-gray-300"> 136 {{ $author.Name }} 137 </span> 138 {{ end }} 139 {{ if gt (len .Authors) 1 }} <span class="text-gray-500">+{{ sub (len .Authors) 1 }}</span>{{ end }} 140 {{ else }} 141 {{ placeholderAvatar "tiny" }} 142 <span class="text-gray-500">unknown</span> 143 {{ end }} 144 </span> 145{{ end }} 146 147{{ define "repoAfter" }} 148 {{ $changes_len := len .Changes }} 149 <div class="flex justify-end mt-4 gap-2"> 150 {{ 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 }} 151 {{ if eq $changes_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 }} 152 </div> 153{{ end }}