Files
lucioandClaude Opus 4.8 8e5eb387c5 Make sidebar a responsive off-canvas drawer on mobile
The fixed 260px sidebar overlapped page content on phones. Below
768px the app container now stacks vertically: a full-width hamburger
top bar sits above the content, the sidebar slides off-canvas behind a
tap/Escape-dismissable backdrop, and the main content uses full width.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-06-06 13:56:10 -07:00

174 lines
11 KiB
HTML

<!DOCTYPE html>
<html lang="{{.Lang}}">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{block "title" .}}{{T "app.title"}}{{end}}</title>
<!-- Dynamic CSRF Metadata for HTMX requests -->
<meta name="csrf-token" content="{{.CSRFToken}}">
<!-- Styles & Fonts -->
<link rel="stylesheet" href="/static/css/styles.css">
<!-- Self-contained scripts serving fully offline -->
<script src="/static/js/htmx.min.js"></script>
<script src="/static/js/main.js"></script>
</head>
<body>
<div class="app-container {{if not .IsAuthenticated}}public-layout{{end}}">
<!-- Sidebar Navigation -->
{{if .IsAuthenticated}}
<!-- Mobile Top Bar (hidden on desktop) -->
<header class="mobile-topbar">
<button type="button" class="mobile-menu-btn" aria-label="{{T "nav.menu"}}" aria-controls="sidebar" onclick="toggleSidebar()">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5" />
</svg>
</button>
<div class="brand">
<div class="brand-logo">S</div>
<span class="brand-name">Solis</span>
</div>
</header>
<!-- Backdrop shown behind the drawer on mobile -->
<div class="sidebar-backdrop" onclick="closeSidebar()"></div>
<aside class="sidebar" id="sidebar">
<div class="brand">
<div class="brand-logo">S</div>
<span class="brand-name">Solis</span>
</div>
<nav class="sidebar-nav">
<ul class="nav-list">
<li class="nav-item {{if eq .ActiveNav "items"}}active{{end}}">
<a href="/admin" class="nav-link">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M20.25 7.5l-.625 10.632a2.25 2.25 0 01-2.247 2.118H6.622a2.25 2.25 0 01-2.247-2.118L3.75 7.5M10 11.25h4M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125z" />
</svg>
{{T "nav.assets"}}
</a>
</li>
<li class="nav-item {{if eq .ActiveNav "locations"}}active{{end}}">
<a href="/admin/locations" class="nav-link">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M15 10.5a3 3 0 11-6 0 3 3 0 016 0z" />
<path stroke-linecap="round" stroke-linejoin="round" d="M19.5 10.5c0 7.142-7.5 11.25-7.5 11.25s-7.5-4.108-7.5-11.25" />
</svg>
{{T "nav.locations"}}
</a>
</li>
<li class="nav-item {{if eq .ActiveNav "tags"}}active{{end}}">
<a href="/admin/tags" class="nav-link">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M9.568 3H5.25A2.25 2.25 0 003 5.25v4.318c0 .597.237 1.17.659 1.591l9.581 9.581a1.125 1.125 0 001.591 0l4.318-4.318a1.125 1.125 0 000-1.591l-9.581-9.581A2.25 2.25 0 009.568 3z" />
<path stroke-linecap="round" stroke-linejoin="round" d="M6 6h.008v.008H6V6z" />
</svg>
{{T "nav.tags"}}
</a>
</li>
<li class="nav-item {{if eq .ActiveNav "shortener"}}active{{end}}">
<a href="/admin/shortener" class="nav-link">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M13.19 8.688a4.5 4.5 0 011.242 7.244l-4.5 4.5a4.5 4.5 0 01-6.364-6.364l1.757-1.757m13.35-.622l1.757-1.757a4.5 4.5 0 00-6.364-6.364l-4.5 4.5a4.5 4.5 0 001.242 7.244" />
</svg>
{{T "nav.shortlinks"}}
</a>
</li>
<li class="nav-item {{if eq .ActiveNav "print"}}active{{end}}">
<a href="/admin/print" class="nav-link">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M6.72 13.829c-.24.03-.48.062-.72.096m.72-.096a42.415 42.415 0 0110.56 0m-10.56 0L6.34 18m10.94-4.171c.24.03.48.062.72.096m-.72-.096L17.66 18m0 0a2.25 2.25 0 01-2.247 2.118H8.587A2.25 2.25 0 016.34 18m11.32 0h.008v.008h-.008V18zm-12 0h.008v.008H5.66V18zm0-11.25h12.75c.621 0 1.125.504 1.125 1.125v1.5c0 .621-.504 1.125-1.125 1.125H5.66c-.621 0-1.125-.504-1.125-1.125v-1.5c0-.621.504-1.125 1.125-1.125z" />
</svg>
{{T "nav.print_labels"}}
</a>
</li>
</ul>
</nav>
<!-- Sidebar Footer -->
<div class="sidebar-footer">
<form action="/admin/logout" method="POST">
<input type="hidden" name="csrf_token" value="{{$.CSRFToken}}">
<button type="submit" class="btn btn-secondary" style="width: 100%;">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" style="width:16px;height:16px;margin-right:4px;">
<path stroke-linecap="round" stroke-linejoin="round" d="M15.75 9V5.25A2.25 2.25 0 0013.5 3h-6a2.25 2.25 0 00-2.25 2.25v13.5A2.25 2.25 0 007.5 21h6a2.25 2.25 0 002.25-2.25V15M12 9l-3 3m0 0l3 3m-3-3h12.75" />
</svg>
{{T "nav.sign_out"}}
</button>
</form>
</div>
</aside>
{{else}}
<!-- Premium Public Header -->
<header class="public-header">
<div class="public-brand">
<div class="brand-logo">S</div>
<span class="brand-name">Solis</span>
</div>
<div class="public-nav">
<a href="/admin/login" class="btn btn-secondary">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" style="width: 16px; height: 16px; margin-right: 4px;">
<path stroke-linecap="round" stroke-linejoin="round" d="M15.75 6a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0zM4.501 20.118a7.5 7.5 0 0114.998 0A17.933 17.933 0 0112 21.75c-2.676 0-5.216-.584-7.499-1.632z" />
</svg>
{{T "nav.admin_login"}}
</a>
</div>
</header>
{{end}}
<!-- Main Content View Wrapper -->
<main class="main-wrapper">
{{template "content" .}}
</main>
</div>
<!-- Dynamic Slide-in Alert Toasts -->
<div id="toast-container">
{{if .Toast}}
<div class="toast {{if eq .ToastType "success"}}toast-success{{else}}toast-error{{end}}">
<div class="toast-message">{{.Toast}}</div>
<button class="toast-close" onclick="dismissToast(this)">&times;</button>
</div>
{{end}}
</div>
<!-- QR Code Preview Modal -->
<div id="qr-modal-overlay" style="display:none; position:fixed; inset:0; z-index:9999; background:rgba(0,0,0,0.55); backdrop-filter:blur(4px); justify-content:center; align-items:center;">
<div id="qr-modal-card" style="background:var(--color-bg-surface, #fff); border-radius:16px; padding:2.5rem 2rem 2rem; max-width:380px; width:90%; box-shadow:0 24px 48px -12px rgba(0,0,0,0.25); display:flex; flex-direction:column; align-items:center; gap:1.25rem; position:relative; animation:qrModalIn 0.25s cubic-bezier(0.16,1,0.3,1);">
<button onclick="closeQRModal()" style="position:absolute; top:0.75rem; right:0.75rem; background:none; border:none; font-size:1.5rem; cursor:pointer; color:var(--color-text-light); line-height:1;" aria-label="Close">&times;</button>
<h3 style="font-weight:700; font-size:1.15rem; color:var(--color-text-main); margin:0;">{{T "qr.preview"}}</h3>
<img id="qr-modal-image" src="" alt="QR Code" style="width:220px; height:220px; border:1px solid var(--color-border); border-radius:8px; background:#fff; padding:8px;">
<code id="qr-modal-link" style="font-family:monospace; background:var(--color-bg-base, #f5f5f5); padding:0.4rem 0.85rem; border-radius:6px; border:1px solid var(--color-border); font-weight:600; font-size:0.95rem; word-break:break-all; text-align:center;"></code>
<a id="qr-modal-download" download="" href="" class="btn btn-primary" style="width:100%; font-size:0.9rem; text-align:center;">{{T "qr.download"}}</a>
</div>
</div>
<style>
@keyframes qrModalIn {
from { opacity:0; transform:scale(0.92) translateY(12px); }
to { opacity:1; transform:scale(1) translateY(0); }
}
</style>
<script>
function openQRModal(slug, name) {
var overlay = document.getElementById('qr-modal-overlay');
document.getElementById('qr-modal-image').src = '/admin/qr/' + slug;
document.getElementById('qr-modal-link').textContent = '/s/' + slug;
var dl = document.getElementById('qr-modal-download');
dl.href = '/admin/qr/' + slug;
dl.download = (name || slug) + '_QR.png';
overlay.style.display = 'flex';
}
function closeQRModal() {
document.getElementById('qr-modal-overlay').style.display = 'none';
}
document.addEventListener('click', function(e) {
if (e.target && e.target.id === 'qr-modal-overlay') closeQRModal();
});
document.addEventListener('keydown', function(e) {
if (e.key === 'Escape') closeQRModal();
});
</script>
</body>
</html>