MCPcopy
hub / github.com/koala73/worldmonitor / renderSidebar

Function renderSidebar

src/settings-main.ts:107–148  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

105}
106
107function renderSidebar(): void {
108 const nav = document.getElementById('sidebarNav');
109 if (!nav) return;
110
111 const items: string[] = [];
112
113 const progress = getTotalProgress();
114 const overviewDotClass = progress.ready === progress.total ? 'dot-ok' : progress.ready > 0 ? 'dot-partial' : 'dot-warn';
115 items.push(`
116 <button class="settings-nav-item${activeSection === 'overview' ? ' active' : ''}" data-section="overview" role="tab" aria-selected="${activeSection === 'overview'}">
117 ${SIDEBAR_ICONS.overview}
118 <span class="settings-nav-label">Overview</span>
119 <span class="settings-nav-dot ${overviewDotClass}"></span>
120 </button>
121 `);
122
123 items.push('<div class="settings-nav-sep"></div>');
124
125 for (const cat of SETTINGS_CATEGORIES) {
126 const { ready, total } = getFeatureStatusCounts(cat);
127 const dotClass = ready === total ? 'dot-ok' : ready > 0 ? 'dot-partial' : 'dot-warn';
128 items.push(`
129 <button class="settings-nav-item${activeSection === cat.id ? ' active' : ''}" data-section="${cat.id}" role="tab" aria-selected="${activeSection === cat.id}">
130 ${SIDEBAR_ICONS[cat.id] || ''}
131 <span class="settings-nav-label">${escapeHtml(cat.label)}</span>
132 <span class="settings-nav-count">${ready}/${total}</span>
133 <span class="settings-nav-dot ${dotClass}"></span>
134 </button>
135 `);
136 }
137
138 items.push('<div class="settings-nav-sep"></div>');
139
140 items.push(`
141 <button class="settings-nav-item${activeSection === 'debug' ? ' active' : ''}" data-section="debug" role="tab" aria-selected="${activeSection === 'debug'}">
142 ${SIDEBAR_ICONS.debug}
143 <span class="settings-nav-label">Debug &amp; Logs</span>
144 </button>
145 `);
146
147 nav.innerHTML = items.join('');
148}
149
150// ── Section rendering ──
151

Callers 3

renderSectionFunction · 0.85

Calls 3

escapeHtmlFunction · 0.90
getTotalProgressFunction · 0.85
getFeatureStatusCountsFunction · 0.85

Tested by

no test coverage detected