Files
Glimmer/internal/server/templates/admin.html
T
lucio 9e10bc3031 Redesign UI to match Solis design system
Replace Pico CSS with a custom Solis-style design system — warm amber
on cream, Outfit font, 260px sidebar (logged in) or sticky public
header (logged out), soft amber-tinted shadows, cubic-bezier spring
animations on toasts and modals.

- Add static/css/style.css with the full design token system
- Add base.html + content-block pattern; each page defines its own
  {{define "content"}} and base.html provides the chrome
- pageData gains ActiveNav; adminPage(w, r, nav) sets it; handlers
  pass the right value for every admin route
- Standalone pages (login, 404, embed) render without base.html
- Templates use Solis-style data-table, card, stats-bar, tag-pill,
  alert, btn components
- Remove vendored Pico CSS (83KB) and the old style.css (12KB)
- Update AGENTS.md and CLAUDE.md to reflect the new design system

Bug fixes during the redesign:
- Preview dialog now only shows when [open] (UA default was being
  overridden by display:flex)
- Preview dialog centered via explicit top/left/transform — the
  browser's default margin:auto centering fights with display:flex
  on <dialog>
- Add ?embed=1 route that renders paste content without base.html
  chrome, so the admin paste preview iframe shows only the body

Tested: go build ./... clean, go vet ./... clean, binary boots.
2026-06-06 14:15:19 -07:00

169 lines
7.1 KiB
HTML

{{define "title"}}Admin — Glimmer{{end}}
{{define "content"}}
<div class="page-header">
<div class="page-title">
<h1>Dashboard</h1>
<p>Overview of your short links and recent activity.</p>
</div>
<div class="page-actions">
<a href="/" class="btn btn-primary">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" style="width:18px;height:18px"><path stroke-linecap="round" stroke-linejoin="round" d="M12 4.5v15m7.5-7.5h-15"/></svg>
New Link
</a>
</div>
</div>
{{if .Success}}
<div class="alert alert-success">{{.Success}}</div>
{{end}}
<div class="stats-bar">
<div class="stats-card">
<span class="stats-value">{{len .AdminLinks}}</span>
<span class="stats-label">My Links</span>
</div>
<div class="stats-card">
<span class="stats-value">{{len .AnonLinks}}</span>
<span class="stats-label">Anonymous</span>
</div>
<div class="stats-card">
<span class="stats-value">{{len .TopLinks}}</span>
<span class="stats-label">Quick Links</span>
</div>
</div>
{{if .TopLinks}}
<section style="margin-bottom: 2rem;">
<div class="section-header">
<div>
<h2 class="section-title">Quick Links</h2>
<p class="section-subtitle">Top 20 most-clicked links — one click to open.</p>
</div>
</div>
<div class="tile-grid">
{{range .TopLinks}}
<a href="/{{.Slug}}" class="tile" target="_blank" rel="noopener noreferrer" title="{{.URL}}">
<span class="tile-slug">/{{.Slug}}</span>
<span class="tile-dest" data-hostname>{{.URL}}</span>
<span class="tile-clicks">{{.Clicks}} clicks</span>
</a>
{{end}}
</div>
</section>
{{end}}
<section style="margin-bottom: 2rem;">
<div class="section-header">
<div>
<h2 class="section-title">My Links</h2>
<p class="section-subtitle">{{len .AdminLinks}} links created by you.</p>
</div>
</div>
<div class="card card-flush">
<div class="data-table-wrapper">
<table class="data-table">
<thead>
<tr>
<th>Slug</th>
<th>Destination</th>
<th class="col-numeric">Clicks</th>
<th>Created</th>
<th class="col-actions">Actions</th>
</tr>
</thead>
<tbody>
{{range .AdminLinks}}
<tr>
<td><a href="/{{.Slug}}" target="_blank" rel="noopener noreferrer">/{{.Slug}}</a></td>
<td title="{{.URL}}"><span class="text-truncate" style="display:inline-block;max-width:340px;vertical-align:middle">{{.URL}}</span></td>
<td class="col-numeric">{{.Clicks}}</td>
<td>{{.CreatedAt.Format "2006-01-02 15:04"}}</td>
<td class="col-actions">
<div class="flex gap-1">
<a href="/admin/edit/{{.ID}}" class="btn btn-secondary btn-sm">Edit</a>
<button type="button" class="btn btn-secondary btn-sm" onclick="openQRModal('{{.Slug}}', '{{.Slug}}')">QR</button>
<form method="post" action="/admin/delete/{{.ID}}" style="display:inline" onsubmit="return confirm('Delete /{{.Slug}}?')">
<input type="hidden" name="csrf_token" value="{{$.CSRFToken}}">
<button type="submit" class="btn btn-danger btn-sm">Del</button>
</form>
</div>
</td>
</tr>
{{else}}
<tr><td colspan="5">
<div class="empty-state">
<span class="empty-state-icon">🔗</span>
<p class="empty-state-text">No links yet.</p>
<a href="/" class="btn btn-primary btn-sm empty-state-action">Create your first link</a>
</div>
</td></tr>
{{end}}
</tbody>
</table>
</div>
</div>
</section>
<section style="margin-bottom: 2rem;">
<div class="section-header">
<div>
<h2 class="section-title">Anonymous Links</h2>
<p class="section-subtitle">{{len .AnonLinks}} links created by unauthenticated users.</p>
</div>
</div>
<div class="card card-flush">
<div class="data-table-wrapper">
<table class="data-table">
<thead>
<tr>
<th>Slug</th>
<th>Destination</th>
<th class="col-numeric">Clicks</th>
<th>Created</th>
<th class="col-actions">Actions</th>
</tr>
</thead>
<tbody>
{{range .AnonLinks}}
<tr>
<td><a href="/{{.Slug}}" target="_blank" rel="noopener noreferrer">/{{.Slug}}</a></td>
<td title="{{.URL}}"><span class="text-truncate" style="display:inline-block;max-width:340px;vertical-align:middle">{{.URL}}</span></td>
<td class="col-numeric">{{.Clicks}}</td>
<td>{{.CreatedAt.Format "2006-01-02 15:04"}}</td>
<td class="col-actions">
<div class="flex gap-1">
<a href="/admin/edit/{{.ID}}" class="btn btn-secondary btn-sm">Edit</a>
<button type="button" class="btn btn-secondary btn-sm" onclick="openQRModal('{{.Slug}}', '{{.Slug}}')">QR</button>
<form method="post" action="/admin/delete/{{.ID}}" style="display:inline" onsubmit="return confirm('Delete /{{.Slug}}?')">
<input type="hidden" name="csrf_token" value="{{$.CSRFToken}}">
<button type="submit" class="btn btn-danger btn-sm">Del</button>
</form>
</div>
</td>
</tr>
{{else}}
<tr><td colspan="5">
<div class="empty-state">
<span class="empty-state-icon">👥</span>
<p class="empty-state-text">No anonymous links.</p>
</div>
</td></tr>
{{end}}
</tbody>
</table>
</div>
</div>
</section>
<script>
// Compress URL displays to hostname for visual cleanliness
document.querySelectorAll('[data-hostname]').forEach(function(el) {
try {
var u = new URL(el.textContent.trim());
el.textContent = u.hostname + (u.pathname !== '/' ? u.pathname : '');
} catch (e) {}
});
</script>
{{end}}