fix: admin panel showSection ID mismatch + missing main-content CSS

This commit is contained in:
jae 2026-03-31 23:13:42 +00:00
parent 10bf521db6
commit a1e5cd2f4a
2 changed files with 15 additions and 1 deletions

View file

@ -169,6 +169,16 @@ body {
min-height: 100vh; min-height: 100vh;
} }
/* ─── Main Content ─── */
.main-content {
grid-column: 2;
grid-row: 2;
padding: 2rem;
overflow-y: auto;
max-height: calc(100vh - var(--topbar-h));
background: var(--bg);
}
/* ─── Top Bar ─── */ /* ─── Top Bar ─── */
.admin-topbar { .admin-topbar {
grid-column: 1 / -1; grid-column: 1 / -1;

View file

@ -182,6 +182,9 @@ const AdminApp = {
/* ─────────────────────── NAVIGATION ─────────────────────── */ /* ─────────────────────── NAVIGATION ─────────────────────── */
showSection(name) { showSection(name) {
// Normalize: ensure name has section- prefix
if (!name.startsWith('section-')) name = 'section-' + name;
// Hide all sections // Hide all sections
document.querySelectorAll('[id^="section-"]').forEach(s => { document.querySelectorAll('[id^="section-"]').forEach(s => {
s.style.display = 'none'; s.style.display = 'none';
@ -196,7 +199,8 @@ const AdminApp = {
document.querySelectorAll('.sidebar a, .sidebar .nav-link').forEach(a => { document.querySelectorAll('.sidebar a, .sidebar .nav-link').forEach(a => {
a.classList.remove('active'); a.classList.remove('active');
}); });
const activeLink = document.querySelector(`[onclick*="'${name}'"]`); const shortName = name.replace('section-', '');
const activeLink = document.querySelector(`.sidebar-link[data-section="${shortName}"]`);
if (activeLink) activeLink.classList.add('active'); if (activeLink) activeLink.classList.add('active');
// Update topbar title // Update topbar title