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.
72 lines
2.9 KiB
HTML
72 lines
2.9 KiB
HTML
{{define "title"}}Glimmer{{end}}
|
|
{{define "content"}}
|
|
<div style="max-width: 640px; margin: 1.5rem auto 0;">
|
|
|
|
<div class="card" style="text-align: center; padding: 2.5rem 2rem;">
|
|
<div class="brand" style="justify-content: center; margin-bottom: 1rem;">
|
|
<div class="brand-logo">G</div>
|
|
<span class="brand-name">Glimmer</span>
|
|
</div>
|
|
<h1 style="font-size: 1.75rem; margin-bottom: 0.5rem;">Shorten a URL</h1>
|
|
<p class="text-muted" style="margin-bottom: 2rem;">Paste a long URL and get a short link.</p>
|
|
|
|
{{if .Error}}
|
|
<div class="alert alert-error">{{.Error}}</div>
|
|
{{end}}
|
|
|
|
{{if .ShortURL}}
|
|
<div class="alert alert-success" style="text-align:left;">
|
|
<div style="flex-grow: 1;">
|
|
<strong>Your short link is ready.</strong>
|
|
<p class="text-muted" style="font-size: 0.85rem; margin-top: 0.25rem; word-break: break-all;">{{.OriginalURL}}</p>
|
|
</div>
|
|
</div>
|
|
<div class="result-box">
|
|
<code id="short-url">{{.ShortURL}}</code>
|
|
<button class="btn btn-secondary btn-sm" onclick="copyToClipboard(document.getElementById('short-url').textContent, this)">Copy</button>
|
|
</div>
|
|
{{if .QRSVG}}
|
|
<div class="qr-display">{{.QRSVG}}</div>
|
|
{{end}}
|
|
{{end}}
|
|
|
|
<form method="post" action="/shorten" id="shorten-form" style="text-align: left;">
|
|
<input type="hidden" name="csrf_token" value="{{.CSRFToken}}">
|
|
|
|
<div class="form-group">
|
|
<label for="url" class="form-label">URL to shorten</label>
|
|
<input type="text" inputmode="url" id="url" name="url" placeholder="https://example.com/very/long/url" required>
|
|
</div>
|
|
|
|
{{if .LoggedIn}}
|
|
<div class="form-group">
|
|
<label for="slug" class="form-label">Custom slug <small class="text-muted">(optional)</small></label>
|
|
<input type="text" id="slug" name="slug" placeholder="my-link" pattern="[a-zA-Z0-9_-]+" title="Letters, numbers, hyphens, underscores only">
|
|
<small class="form-help">Leave blank to auto-generate a 3-character slug.</small>
|
|
</div>
|
|
{{end}}
|
|
|
|
<button type="submit" class="btn btn-primary btn-lg btn-block">Shorten</button>
|
|
</form>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<script>
|
|
document.getElementById('shorten-form').addEventListener('submit', function() {
|
|
var input = document.getElementById('url');
|
|
if (input.value && input.value.indexOf('://') === -1) {
|
|
input.value = 'https://' + input.value;
|
|
}
|
|
});
|
|
|
|
function copyToClipboard(text, btn) {
|
|
var orig = btn.textContent;
|
|
navigator.clipboard.writeText(text).then(function() {
|
|
btn.textContent = 'Copied!';
|
|
setTimeout(function() { btn.textContent = orig; }, 1500);
|
|
});
|
|
}
|
|
</script>
|
|
{{end}}
|