homogeineze sidebar conf
This commit is contained in:
@@ -147,6 +147,63 @@ body.spr-sidebar-active.spr-sidebar-expanded {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
/* Vein items under artery icon */
|
||||
.spr-vein-item {
|
||||
width: 36px;
|
||||
height: 28px;
|
||||
font-size: 0.7rem;
|
||||
margin-left: 8px;
|
||||
background: #252525;
|
||||
}
|
||||
|
||||
.spr-vein-item .label {
|
||||
display: block !important;
|
||||
font-size: 0.65rem;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
#spr-sidebar.expanded .spr-vein-item {
|
||||
margin-left: 20px;
|
||||
width: calc(100% - 20px);
|
||||
}
|
||||
|
||||
/* System links (atlas, station when logged in) */
|
||||
.spr-system-link {
|
||||
height: 28px;
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
/* Locked state (not logged in) */
|
||||
.spr-sidebar-locked {
|
||||
width: 44px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #555;
|
||||
font-size: 0.5rem;
|
||||
margin-bottom: 0.5rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.spr-sidebar-locked .lock-text {
|
||||
writing-mode: vertical-rl;
|
||||
text-orientation: mixed;
|
||||
transform: rotate(180deg);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
#spr-sidebar.expanded .spr-sidebar-locked {
|
||||
width: 100%;
|
||||
justify-content: flex-start;
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
#spr-sidebar.expanded .spr-sidebar-locked .lock-text {
|
||||
writing-mode: horizontal-tb;
|
||||
transform: none;
|
||||
}
|
||||
|
||||
/* User/Auth Section */
|
||||
.spr-sidebar-user {
|
||||
margin-top: auto;
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
const SPR_BASE = "/spr";
|
||||
// Soleprint routes are at root (no prefix)
|
||||
const SPR_BASE = "";
|
||||
|
||||
let config = null;
|
||||
let user = null;
|
||||
@@ -56,7 +57,7 @@
|
||||
|
||||
async function init() {
|
||||
try {
|
||||
// Load config
|
||||
// Load config using dynamic base URL
|
||||
const response = await fetch(`${SPR_BASE}/api/sidebar/config`);
|
||||
config = await response.json();
|
||||
|
||||
@@ -88,6 +89,50 @@
|
||||
}
|
||||
}
|
||||
|
||||
function renderSystemSection(systemKey, title) {
|
||||
const veins = config.veins || [];
|
||||
|
||||
// System icon - ALWAYS shown as non-clickable separator
|
||||
let html = `
|
||||
<div class="spr-sidebar-icon" title="${title}">
|
||||
${icons[systemKey]}
|
||||
</div>
|
||||
`;
|
||||
|
||||
// Nested elements below icon - auth-gated
|
||||
if (user) {
|
||||
// Logged in
|
||||
if (systemKey === "artery") {
|
||||
// Show vein links under artery
|
||||
for (const vein of veins) {
|
||||
html += `
|
||||
<a href="${SPR_BASE}/artery/${vein}" class="spr-sidebar-item spr-vein-item" title="${vein}">
|
||||
<span class="label">${vein}</span>
|
||||
<span class="tooltip">${vein}</span>
|
||||
</a>
|
||||
`;
|
||||
}
|
||||
} else {
|
||||
// Atlas/Station: clickable link to main page
|
||||
html += `
|
||||
<a href="${SPR_BASE}/${systemKey}" class="spr-sidebar-item spr-system-link" title="${title}">
|
||||
<span class="label">${title}</span>
|
||||
<span class="tooltip">${title}</span>
|
||||
</a>
|
||||
`;
|
||||
}
|
||||
} else if (config.auth_enabled) {
|
||||
// Not logged in: show "login to access" below each system icon
|
||||
html += `
|
||||
<div class="spr-sidebar-locked">
|
||||
<span class="lock-text">login to access</span>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
function createSidebar() {
|
||||
// Add body class
|
||||
document.body.classList.add("spr-sidebar-active");
|
||||
@@ -122,17 +167,9 @@
|
||||
|
||||
<div class="spr-sidebar-divider"></div>
|
||||
|
||||
<div class="spr-sidebar-icon" title="Artery">
|
||||
${icons.artery}
|
||||
</div>
|
||||
|
||||
<div class="spr-sidebar-icon" title="Atlas">
|
||||
${icons.atlas}
|
||||
</div>
|
||||
|
||||
<div class="spr-sidebar-icon" title="Station">
|
||||
${icons.station}
|
||||
</div>
|
||||
${renderSystemSection("artery", "Artery")}
|
||||
${renderSystemSection("atlas", "Atlas")}
|
||||
${renderSystemSection("station", "Station")}
|
||||
|
||||
<div class="spr-sidebar-spacer"></div>
|
||||
|
||||
@@ -167,9 +204,12 @@
|
||||
</div>
|
||||
`;
|
||||
} else {
|
||||
// Include current page as redirect target after login
|
||||
const redirectUrl = encodeURIComponent(window.location.href);
|
||||
const loginUrl = `${config.auth.login_url}?redirect=${redirectUrl}`;
|
||||
return `
|
||||
<div class="spr-sidebar-user">
|
||||
<a href="${config.auth.login_url}" class="spr-sidebar-item" title="Login with Google">
|
||||
<a href="${loginUrl}" class="spr-sidebar-item" title="Login with Google">
|
||||
${icons.google}
|
||||
<span class="label">Login</span>
|
||||
<span class="tooltip">Login</span>
|
||||
|
||||
Reference in New Issue
Block a user