forked from tangled.org/core
Monorepo for Tangled — https://tangled.org

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
···
{{ define "title" }}commits · {{ .RepoInfo.FullName }}{{ end }}
{{ define "repoContent" }}
-
<section id="commit-table">
-
<table class="w-full border-collapse">
+
<section id="commit-table" class="overflow-x-auto">
+
<!-- desktop view (hidden on small screens) -->
+
<table class="w-full border-collapse hidden md:table">
<thead class="bg-gray-100 dark:bg-gray-700">
<tr>
<th class="px-4 py-2 text-sm text-left text-gray-700 dark:text-gray-300 uppercase font-bold">Author</th>
···
{{ end }}
</tbody>
</table>
+
+
<!-- mobile view (visible only on small screens) -->
+
<div class="md:hidden">
+
<h2 class="p-2 text-sm text-left text-gray-700 dark:text-gray-300 uppercase font-bold">commits</h2>
+
{{ range $commit := .Commits }}
+
<div class="relative p-2 border-b border-gray-200 dark:border-gray-700">
+
<div id="commit-message">
+
{{ $messageParts := splitN $commit.Message "\n\n" 2 }}
+
<div class="text-base cursor-pointer">
+
<div>
+
<div class="flex items-center justify-between">
+
<div class="flex-1">
+
<a href="/{{ $.RepoInfo.FullName }}/commit/{{ $commit.Hash.String }}"
+
class="inline no-underline hover:underline dark:text-white">
+
{{ index $messageParts 0 }}
+
</a>
+
{{ if gt (len $messageParts) 1 }}
+
<button
+
class="py-1/2 px-1 bg-gray-200 hover:bg-gray-400 rounded dark:bg-gray-700 dark:hover:bg-gray-600"
+
hx-on:click="this.nextElementSibling.classList.toggle('hidden')">
+
{{ i "ellipsis" "w-3 h-3" }}
+
</button>
+
{{ end }}
+
{{ if gt (len $messageParts) 1 }}
+
<p class="hidden mt-1 text-sm cursor-text pb-2 dark:text-gray-300">
+
{{ nl2br (index $messageParts 1) }}
+
</p>
+
{{ end }}
+
</div>
+
<a href="/{{ $.RepoInfo.FullName }}/tree/{{ $commit.Hash.String }}"
+
class="p-1 mr-1 hover:bg-gray-100 dark:hover:bg-gray-700 rounded"
+
title="Browse repository at this commit">
+
{{ i "folder-code" "w-4 h-4" }}
+
</a>
+
</div>
+
+
</div>
+
</div>
+
</div>
+
+
<div class="text-xs text-gray-500 dark:text-gray-400">
+
<span class="font-mono">
+
<a href="/{{ $.RepoInfo.FullName }}/commit/{{ $commit.Hash.String }}"
+
class="text-gray-500 dark:text-gray-400 no-underline hover:underline">
+
{{ slice $commit.Hash.String 0 8 }}
+
</a>
+
</span>
+
<span class="mx-2 before:content-['·'] before:select-none"></span>
+
<span>
+
{{ $didOrHandle := index $.EmailToDidOrHandle $commit.Author.Email }}
+
<a href="{{ if $didOrHandle }}/{{ $didOrHandle }}{{ else }}mailto:{{ $commit.Author.Email }}{{ end }}"
+
class="text-gray-500 dark:text-gray-400 no-underline hover:underline">
+
{{ if $didOrHandle }}{{ $didOrHandle }}{{ else }}{{ $commit.Author.Name }}{{ end }}
+
</a>
+
</span>
+
<div class="inline-block px-1 select-none after:content-['·']"></div>
+
<span>{{ shortTimeFmt $commit.Author.When }}</span>
+
</div>
+
</div>
+
{{ end }}
+
</div>
</section>
{{ $commits_len := len .Commits }}