feat(ui): show current commit version and date in admin sidebar
This commit is contained in:
@@ -29,6 +29,7 @@ body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;b
|
||||
.sidebar nav a.active svg{color:var(--accent)}
|
||||
.sidebar .bottom a[data-nav=home] svg{color:#2563eb}
|
||||
.sidebar .bottom{padding:12px 20px;border-top:1px solid var(--border)}
|
||||
.sidebar .version{color:var(--muted);font-size:.72rem;padding:0 20px 8px}
|
||||
.sidebar .bottom a{display:flex;align-items:center;gap:10px;color:var(--muted);text-decoration:none;font-size:.8rem;padding:6px 0}
|
||||
.sidebar .bottom a:hover{color:var(--text)}
|
||||
.sidebar .bottom .logout{color:#ef4444;cursor:pointer;margin-top:4px}
|
||||
|
||||
@@ -77,10 +77,26 @@ function buildSidebar(active) {
|
||||
${nav.map(n => `<a href="${n.page}.html" data-nav="${n.page}" class="${n.page === active ? 'active' : ''}"><i data-lucide="${n.icon}"></i>${n.label}</a>`).join('')}
|
||||
</nav>
|
||||
<div class="bottom">
|
||||
<div class="version" id="sidebarVersion"></div>
|
||||
<a href="/" data-nav="home"><i data-lucide="home"></i>На главную</a>
|
||||
<a class="logout" href="#" data-action="logout"><i data-lucide="log-out"></i>Выйти</a>
|
||||
</div>`;
|
||||
renderIcons();
|
||||
loadVersion();
|
||||
}
|
||||
|
||||
async function loadVersion() {
|
||||
const el = document.getElementById('sidebarVersion');
|
||||
if (!el) return;
|
||||
try {
|
||||
const res = await fetch(`${API}/version.json?t=${Date.now()}`);
|
||||
if (!res.ok) { el.textContent = ''; return; }
|
||||
const v = await res.json();
|
||||
if (!v.short) { el.textContent = ''; return; }
|
||||
const d = (v.date || '').slice(0, 10);
|
||||
el.textContent = `v${v.short}${d ? ' · ' + d : ''}`;
|
||||
el.title = `${v.short} · ${v.date || ''}`;
|
||||
} catch { el.textContent = ''; }
|
||||
}
|
||||
|
||||
// --- Common UI ---
|
||||
|
||||
Reference in New Issue
Block a user