Files
jukebox_maker/web/templates/layout.html

49 lines
1.3 KiB
HTML

{{define "layout"}}<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{.Title}} — Jukebox Maker</title>
<link rel="stylesheet" href="/static/style.css">
</head>
<body>
<header class="page-header">
<h1>🎵 Jukebox Maker</h1>
<nav class="header-nav">
<a href="/" class="header-action {{if eq .Page "dashboard"}}active{{end}}">Dashboard</a>
<a href="/settings" class="header-action {{if eq .Page "settings"}}active{{end}}">Settings</a>
</nav>
</header>
<main class="page-main">
{{template "content" .}}
</main>
<footer class="page-footer">
<span>Version {{.Version}}</span>
</footer>
<div class="toast-container" id="toastContainer"></div>
<script>
function toast(msg, type) {
const c = document.getElementById('toastContainer');
const t = document.createElement('div');
t.className = 'toast toast-' + (type === 'error' ? 'error' : 'ok');
t.textContent = msg;
c.appendChild(t);
setTimeout(() => t.remove(), 4000);
}
function fmtBytes(b) {
if (!b) return '—';
if (b >= 1e12) return (b/1e12).toFixed(1) + ' TB';
if (b >= 1e9) return (b/1e9).toFixed(1) + ' GB';
if (b >= 1e6) return (b/1e6).toFixed(1) + ' MB';
return (b/1e3).toFixed(0) + ' KB';
}
</script>
</body>
</html>
{{end}}