feat(ui): show current commit version and date in admin sidebar
This commit is contained in:
@@ -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