Spaces:
Running
Running
File size: 5,625 Bytes
411ed67 c15a783 411ed67 c15a783 411ed67 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | class SidebarNav extends HTMLElement {
constructor() {
super();
this.attachShadow({ mode: 'open' });
}
connectedCallback() {
this.render();
this.attachEvents();
}
render() {
this.shadowRoot.innerHTML = `
<style>
:host {
display: block;
width: 250px;
background-color: #0f172a;
border-right: 1px solid #1e293b;
display: flex;
flex-direction: column;
}
.brand {
padding: 1.5rem;
font-size: 1.25rem;
font-weight: bold;
color: #10b981; /* Green */
border-bottom: 1px solid #1e293b;
display: flex;
align-items: center;
gap: 0.5rem;
}
.nav-links {
list-style: none;
padding: 1rem 0;
margin: 0;
}
.nav-item a {
display: flex;
align-items: center;
gap: 0.75rem;
padding: 0.75rem 1.5rem;
color: #94a3b8;
text-decoration: none;
transition: all 0.2s;
border-right: 3px solid transparent;
}
.nav-item a:hover {
background-color: rgba(16, 185, 129, 0.05);
color: #e2e8f0;
}
.nav-item a.active {
background-color: rgba(16, 185, 129, 0.1);
color: #10b981;
border-right: 3px solid #10b981;
}
.nav-item i {
width: 18px;
height: 18px;
}
.system-status {
margin-top: auto;
padding: 1.5rem;
border-top: 1px solid #1e293b;
}
.status-dot {
height: 8px;
width: 8px;
background-color: #10b981;
border-radius: 50%;
display: inline-block;
margin-right: 8px;
box-shadow: 0 0 8px #10b981;
}
.status-text {
font-size: 0.75rem;
color: #64748b;
}
/* Mobile handling */
@media (max-width: 768px) {
:host {
position: absolute;
left: -250px;
height: 100%;
z-index: 50;
transition: left 0.3s;
}
:host.open {
left: 0;
}
}
</style>
<div class="brand">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="text-ai-orange"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/></svg>
OmniLoop
</div>
<ul class="nav-links">
<li class="nav-item">
<a href="#dashboard" id="link-dashboard">
<i data-feather="grid"></i> Dashboard
</a>
</li>
<li class="nav-item">
<a href="#knowledge" id="link-knowledge">
<i data-feather="database"></i> Knowledge Base
</a>
</li>
<li class="nav-item">
<a href="#" onclick="return false;">
<i data-feather="users"></i> Hive Mind
</a>
</li>
<li class="nav-item">
<a href="voice.html">
<i data-feather="mic"></i> Voice Lab
</a>
</li>
<li class="nav-item">
<a href="settings.html">
<i data-feather="settings"></i> Configuration
</a>
</li>
</ul>
<div class="system-status">
<div class="flex items-center mb-2">
<span class="status-dot animate-pulse"></span>
<span class="status-text text-white font-mono">CORE STABLE</span>
</div>
<div class="text-xs text-slate-600">Ver 4.2.0-Alpha</div>
</div>
`;
}
attachEvents() {
// Listen for route changes from main script to update active class
document.addEventListener('route-change', (e) => {
const hash = e.detail.hash;
const links = this.shadowRoot.querySelectorAll('.nav-item a');
links.forEach(link => {
link.classList.remove('active');
// Check if href matches hash
if(link.getAttribute('href') === hash) {
link.classList.add('active');
}
});
});
// Re-initialize icons inside shadow DOM
if (window.feather) {
window.feather.replace();
}
}
}
customElements.define('nav-sidebar', SidebarNav); |