Mirror of @tangled.org/core. Running on a Raspberry Pi Zero 2 (Please be gentle).

appview: pages/templates/repo: more commit log improvements

anirudh.fi 8bed72cd 13c07b71

verified
+64 -2
+64 -2
appview/pages/templates/repo/log.html
··· 1 1 {{ define "title" }}commits &middot; {{ .RepoInfo.FullName }}{{ end }} 2 2 {{ define "repoContent" }} 3 - <section id="commit-table"> 4 - <table class="w-full border-collapse"> 3 + <section id="commit-table" class="overflow-x-auto"> 4 + <!-- desktop view (hidden on small screens) --> 5 + <table class="w-full border-collapse hidden md:table"> 5 6 <thead class="bg-gray-100 dark:bg-gray-700"> 6 7 <tr> 7 8 <th class="px-4 py-2 text-sm text-left text-gray-700 dark:text-gray-300 uppercase font-bold">Author</th> ··· 57 56 {{ end }} 58 57 </tbody> 59 58 </table> 59 + 60 + <!-- mobile view (visible only on small screens) --> 61 + <div class="md:hidden"> 62 + <h2 class="p-2 text-sm text-left text-gray-700 dark:text-gray-300 uppercase font-bold">commits</h2> 63 + {{ range $commit := .Commits }} 64 + <div class="relative p-2 border-b border-gray-200 dark:border-gray-700"> 65 + <div id="commit-message"> 66 + {{ $messageParts := splitN $commit.Message "\n\n" 2 }} 67 + <div class="text-base cursor-pointer"> 68 + <div> 69 + <div class="flex items-center justify-between"> 70 + <div class="flex-1"> 71 + <a href="/{{ $.RepoInfo.FullName }}/commit/{{ $commit.Hash.String }}" 72 + class="inline no-underline hover:underline dark:text-white"> 73 + {{ index $messageParts 0 }} 74 + </a> 75 + {{ if gt (len $messageParts) 1 }} 76 + <button 77 + class="py-1/2 px-1 bg-gray-200 hover:bg-gray-400 rounded dark:bg-gray-700 dark:hover:bg-gray-600" 78 + hx-on:click="this.nextElementSibling.classList.toggle('hidden')"> 79 + {{ i "ellipsis" "w-3 h-3" }} 80 + </button> 81 + {{ end }} 82 + {{ if gt (len $messageParts) 1 }} 83 + <p class="hidden mt-1 text-sm cursor-text pb-2 dark:text-gray-300"> 84 + {{ nl2br (index $messageParts 1) }} 85 + </p> 86 + {{ end }} 87 + </div> 88 + <a href="/{{ $.RepoInfo.FullName }}/tree/{{ $commit.Hash.String }}" 89 + class="p-1 mr-1 hover:bg-gray-100 dark:hover:bg-gray-700 rounded" 90 + title="Browse repository at this commit"> 91 + {{ i "folder-code" "w-4 h-4" }} 92 + </a> 93 + </div> 94 + 95 + </div> 96 + </div> 97 + </div> 98 + 99 + <div class="text-xs text-gray-500 dark:text-gray-400"> 100 + <span class="font-mono"> 101 + <a href="/{{ $.RepoInfo.FullName }}/commit/{{ $commit.Hash.String }}" 102 + class="text-gray-500 dark:text-gray-400 no-underline hover:underline"> 103 + {{ slice $commit.Hash.String 0 8 }} 104 + </a> 105 + </span> 106 + <span class="mx-2 before:content-['·'] before:select-none"></span> 107 + <span> 108 + {{ $didOrHandle := index $.EmailToDidOrHandle $commit.Author.Email }} 109 + <a href="{{ if $didOrHandle }}/{{ $didOrHandle }}{{ else }}mailto:{{ $commit.Author.Email }}{{ end }}" 110 + class="text-gray-500 dark:text-gray-400 no-underline hover:underline"> 111 + {{ if $didOrHandle }}{{ $didOrHandle }}{{ else }}{{ $commit.Author.Name }}{{ end }} 112 + </a> 113 + </span> 114 + <div class="inline-block px-1 select-none after:content-['·']"></div> 115 + <span>{{ shortTimeFmt $commit.Author.When }}</span> 116 + </div> 117 + </div> 118 + {{ end }} 119 + </div> 60 120 </section> 61 121 62 122 {{ $commits_len := len .Commits }}