firebreak/web/app/templates/dashboard.html
ZTatman a0617c6be4 refactor(web): decompose main.py into a composition root
Move page routes to routers/dashboard.py, the content-negotiated error
handler to errors.py (register_error_handlers), and the dev css-mtime
endpoint to routers/dev.py (included only when debug). main.py shrinks to
lifespan + wiring + the / landing route.

Dashboard repos now load lazily via an htmx fragment so a slow/unreachable
Forgejo instance never blocks first paint; Forgejo html_url is sanitized
against non-http(s) schemes before rendering into href.
2026-06-10 17:03:10 -04:00

85 lines
3.2 KiB
HTML

{% extends "base.html" %}
{% block title %}Dashboard — Firebreak{% endblock %}
{% block content %}
<div class="flex flex-col gap-10">
<section class="page-header">
<div>
<p class="text-xs font-semibold uppercase tracking-[0.14em] text-muted-foreground">Dashboard</p>
<h1 class="mt-3 text-3xl font-semibold leading-tight text-foreground sm:text-4xl">
Welcome, {{ user.display_name or user.email }}.
</h1>
<p class="mt-2 text-base leading-7 text-foreground/68 sm:text-lg">
Private repository snapshots and access boundaries.
</p>
</div>
</section>
{% if not user.has_pat %}
<div class="notice-rail">
<p class="text-sm font-semibold text-warning-foreground">Access token required</p>
<p class="mt-1 text-sm leading-6 text-muted-foreground">
Register a Forgejo access token to fetch repositories and create share links.
</p>
<a href="/settings" class="mt-3 btn btn-sm btn-link w-fit">Go to Settings</a>
</div>
{% endif %}
{% if user.has_pat %}
<div hx-get="/dashboard/repositories"
hx-trigger="load"
hx-swap="innerHTML">
<section class="table-panel">
<div class="flex flex-col gap-1 px-5 py-4 border-b border-border">
<h2 class="text-base font-semibold text-foreground">Repositories</h2>
<p class="text-sm leading-6 text-muted-foreground">
Your Forgejo repositories. Create a share link to grant temporary read-only access.
</p>
</div>
<div class="px-5 py-8 text-sm text-center text-muted-foreground">Loading repositories…</div>
</section>
</div>
{% endif %}
<section class="table-panel">
<div class="flex flex-col gap-1 px-5 py-4 border-b border-border">
<h2 class="text-base font-semibold text-foreground">Share links</h2>
<p class="text-sm leading-6 text-muted-foreground">
Read-only repository snapshots published from this account.
</p>
</div>
<div class="table-shell">
<table class="data-table">
<thead>
<tr>
<th>Repository</th>
<th>Commit</th>
<th>Status</th>
<th>Views</th>
<th>Expires</th>
</tr>
</thead>
<tbody>
<tr class="table-empty">
<td colspan="5">You have not created any share links yet.</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
<script>
function localizeDates(root) {
(root || document).querySelectorAll("time[data-local-date]").forEach((time) => {
const value = time.getAttribute("datetime");
if (!value) return;
const date = new Date(value);
if (Number.isNaN(date.valueOf())) return;
time.textContent = new Intl.DateTimeFormat(undefined, {
month: "short",
day: "numeric",
year: "numeric",
}).format(date);
});
}
localizeDates(document);
// Repositories load lazily via htmx, so re-localize their dates after swap.
document.body.addEventListener("htmx:afterSwap", (event) => localizeDates(event.target));
</script>
{% endblock %}