aboutsummaryrefslogtreecommitdiff
path: root/views/_tree.eta
diff options
context:
space:
mode:
authorJoe Mou <dev@mou.fo>2026-07-21 17:46:58 -0400
committerJoe Mou <dev@mou.fo>2026-07-22 23:25:26 -0400
commitecd01c4617ec0a6af05cfc4388bdc82986f25961 (patch)
tree89aa59db1c191af4ed6ccb4196fc800d74a195e6 /views/_tree.eta
parentfb16dc2b017e339e6a36a89c9b5d8a830ce3a541 (diff)
Add async branch/tag dropdown and latest-commit bar
Adds two lazily-fetched UI pieces to match vanilla GitHub while keeping initial page loads plain server-rendered HTML: a branch/tag selector (native <dialog>, CSS anchor-positioned to its button, light-dismissed via closedby="any") and a latest-commit bar above the file listing. Both are populated by new /api/:owner/:repo/refs/:type and /api/:owner/:repo/latest-commit/:branch/:path routes; the latter calls GitHub's own /latest-commit JSON endpoint (the same one the React UI uses) rather than scraping the full commit history page.
Diffstat (limited to 'views/_tree.eta')
-rw-r--r--views/_tree.eta3
1 files changed, 3 insertions, 0 deletions
diff --git a/views/_tree.eta b/views/_tree.eta
index ed6eee9..a0ecfab 100644
--- a/views/_tree.eta
+++ b/views/_tree.eta
@@ -1,5 +1,8 @@
<%~ include("./_nav.eta", {...it, isTree: true}) %>
+<% const commitPath = it.path && it.path !== "/" ? it.path : ""; %>
+<div class="latest-commit-placeholder box" data-src="/api/<%= it.repo.owner %>/<%= it.repo.name %>/latest-commit/<%= it.branch %>/<%= commitPath %>">Loading latest commit…</div>
+
<table>
<% for (const item of it.items) { %>
<tr>