fix: sidebar min-height 100vh + sticky logout

This commit is contained in:
Accusys
2026-05-18 12:11:58 +08:00
parent e0a6fdf143
commit 99cef1a18b

View File

@@ -8,14 +8,15 @@
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f5f5f5; color: #333; }
#app { display: flex; min-height: 100vh; }
.sidebar { width: 260px; background: #fff; border-right: 1px solid #ddd; padding: 20px; display: flex; flex-direction: column; }
html, body { height: 100%; }
.sidebar { width: 260px; min-height: 100vh; background: #fff; border-right: 1px solid #ddd; padding: 20px; display: flex; flex-direction: column; }
.sidebar h1 { font-size: 18px; margin-bottom: 16px; }
.sidebar a { display: block; padding: 6px 0; color: #0066cc; text-decoration: none; font-size: 14px; cursor: pointer; }
.sidebar a:hover { color: #003d80; }
.sidebar .active { font-weight: 600; color: #003d80; }
.sidebar .logout { margin-top: auto; padding-top: 16px; border-top: 1px solid #eee; }
.sidebar .logout a { font-size: 12px; color: #999; cursor: pointer; }
.sidebar .logout a:hover { color: #cc0000; }
.sidebar .logout { margin-top: auto; padding-top: 16px; border-top: 1px solid #eee; position: sticky; bottom: 20px; }
.sidebar .logout a { font-size: 13px; color: #cc0000; cursor: pointer; font-weight: 600; }
.sidebar .logout a:hover { color: #990000; text-decoration: underline; }
.content { flex: 1; padding: 40px; max-width: 960px; }
.content table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: 14px; }
.content th, .content td { border: 1px solid #ddd; padding: 8px 12px; text-align: left; }
@@ -147,6 +148,17 @@ async function init() {
a.onclick = function(e) { e.preventDefault(); loadDoc(m[0]); };
listEl.appendChild(a);
});
// Watch for logout disappearing
var lo = document.getElementById('logout-btn');
if (lo) {
var loObs = new MutationObserver(function() {
if (!document.getElementById('logout-btn')) {
document.getElementById('content').innerHTML += '<p style="color:orange">⚠️ logout removed from DOM</p>';
}
});
loObs.observe(document.body, {childList: true, subtree: true});
}
document.getElementById('logout-btn').onclick = async function(e) {
e.preventDefault();
e.stopPropagation();