The 'Status · Contained — 0 exposed' line was more chrome than signal on the empty Share links panel; the plain 'No active share links' invitation reads cleaner. Tightens the spacing to match. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
131 lines
6.1 KiB
HTML
131 lines
6.1 KiB
HTML
{% extends "base.html" %}
|
|
{% block title %}Dashboard — Firebreak{% endblock %}
|
|
{% block content %}
|
|
<div class="flex flex-col gap-6 sm:gap-8">
|
|
<section>
|
|
<h1 class="text-2xl font-semibold leading-tight text-foreground sm:text-3xl">
|
|
Welcome, {{ user.display_name or user.email }}.
|
|
</h1>
|
|
<p class="mt-2 text-sm leading-7 text-muted-foreground sm:text-base">
|
|
Private repository snapshots and access boundaries.
|
|
</p>
|
|
<div class="firebreak-rule mt-6" aria-hidden="true"></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 w-fit btn-link">Go to Settings</a>
|
|
</div>
|
|
{% endif %}
|
|
{% if user.has_pat %}
|
|
{# min-h reserves the swapped-in table's space so content below doesn't jump (CLS) #}
|
|
<div id="repositories-region" class="min-h-64">
|
|
<section class="table-panel"
|
|
hx-get="/dashboard/repositories"
|
|
hx-trigger="load"
|
|
hx-swap="outerHTML">
|
|
<div class="flex flex-col gap-1 border-b border-border px-4 py-3.5 sm:px-5 sm:py-4">
|
|
<h2 class="flex items-center gap-2 text-base font-semibold text-foreground">
|
|
<svg class="status-icon text-muted-foreground"
|
|
viewBox="0 0 24 24"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
stroke-width="2"
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
aria-hidden="true">
|
|
<path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z" />
|
|
</svg>
|
|
Repositories
|
|
</h2>
|
|
<p class="text-sm leading-6 text-muted-foreground">
|
|
Create a share link to grant temporary read-only access.
|
|
</p>
|
|
</div>
|
|
{# Skeleton rows #}
|
|
<p class="sr-only" role="status">Loading repositories…</p>
|
|
<div class="divide-y divide-border-subtle" aria-hidden="true">
|
|
<div class="flex items-center gap-6 px-4 py-4 sm:px-5">
|
|
<span class="skeleton-bar w-44"></span>
|
|
<span class="skeleton-bar w-14"></span>
|
|
<span class="skeleton-bar hidden w-12 sm:inline-block"></span>
|
|
<span class="skeleton-bar ml-auto w-20"></span>
|
|
</div>
|
|
<div class="flex items-center gap-6 px-4 py-4 sm:px-5">
|
|
<span class="skeleton-bar w-36"></span>
|
|
<span class="skeleton-bar w-14"></span>
|
|
<span class="skeleton-bar hidden w-12 sm:inline-block"></span>
|
|
<span class="skeleton-bar ml-auto w-20"></span>
|
|
</div>
|
|
<div class="flex items-center gap-6 px-4 py-4 sm:px-5">
|
|
<span class="skeleton-bar w-52"></span>
|
|
<span class="skeleton-bar w-14"></span>
|
|
<span class="skeleton-bar hidden w-12 sm:inline-block"></span>
|
|
<span class="skeleton-bar ml-auto w-20"></span>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
{% endif %}
|
|
<section class="table-panel">
|
|
<div class="flex flex-col gap-1 border-b border-border px-4 py-3.5 sm:px-5 sm:py-4">
|
|
<h2 class="flex items-center gap-2 text-base font-semibold text-foreground">
|
|
<svg class="status-icon {% if exposure.active %}text-ember{% else %}text-muted-foreground{% endif %}"
|
|
viewBox="0 0 24 24"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
stroke-width="2"
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
{% if exposure.active %}role="img" aria-label="Live"{% else %}aria-hidden="true"{% endif %}>
|
|
<path d="M9 17H7A5 5 0 0 1 7 7h2m6 0h2a5 5 0 1 1 0 10h-2m-7-5h8" />
|
|
</svg>
|
|
Share links
|
|
</h2>
|
|
<p class="text-sm leading-6 text-muted-foreground">
|
|
Repository snapshots published from this account.
|
|
</p>
|
|
</div>
|
|
{# Empty state — share-link data isn't wired yet; the populated table
|
|
(thead + rows) belongs here once links exist. #}
|
|
<div class="px-5 py-10 text-center">
|
|
<p class="mt-1 text-sm font-medium text-foreground">No active share links</p>
|
|
<p class="mt-1 text-sm leading-6 text-muted-foreground">
|
|
Create one from a repository above to grant temporary, read-only access.
|
|
</p>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
<script>
|
|
function localizeDates(root) {
|
|
const scope = root || document;
|
|
const absolute = new Intl.DateTimeFormat(undefined, {
|
|
month: "short",
|
|
day: "numeric",
|
|
year: "numeric",
|
|
});
|
|
scope.querySelectorAll("time[data-local-date]").forEach((time) => {
|
|
const date = new Date(time.getAttribute("datetime"));
|
|
if (Number.isNaN(date.valueOf())) return;
|
|
time.textContent = absolute.format(date);
|
|
});
|
|
// Operational consoles read recency: "3d ago" / "in 3d", absolute on hover.
|
|
const relative = new Intl.RelativeTimeFormat(undefined, { numeric: "auto", style: "narrow" });
|
|
scope.querySelectorAll("time[data-relative-date]").forEach((time) => {
|
|
const date = new Date(time.getAttribute("datetime"));
|
|
if (Number.isNaN(date.valueOf())) return;
|
|
const seconds = (date - Date.now()) / 1000;
|
|
const units = [["day", 86400], ["hour", 3600], ["minute", 60]];
|
|
const [unit, size] = units.find(([, s]) => Math.abs(seconds) >= s) || ["minute", 60];
|
|
time.textContent = relative.format(Math.trunc(seconds / size), unit);
|
|
time.title = absolute.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 %}
|