forked from tangled.org/core
Monorepo for Tangled

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

anirudh.fi 8bed72cd 13c07b71

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