MCPcopy
hub / github.com/sansan0/TrendRadar / renderModules

Function renderModules

docs/assets/script.js:719–751  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

717// 3. 渲染逻辑
718// ==========================================
719function renderModules() {
720 const container = document.getElementById('config-panel');
721 container.innerHTML = '';
722
723 renderModuleNav();
724
725 MODULE_DEFS.forEach(mod => {
726 const card = document.createElement('div');
727 card.className = `module-card ${mod.editable ? 'active' : 'disabled'}`;
728 card.id = `module-${mod.key}`;
729
730 const header = `
731 <div class="module-header px-4 py-3 flex items-center justify-between cursor-pointer" onclick="scrollToModuleInEditor('${mod.key}')">
732 <div class="flex items-center">
733 <span class="text-sm font-bold">${mod.name}</span>
734 <i class="fa-solid fa-arrow-up-right-from-square text-blue-400 text-[10px] ml-2 opacity-0 group-hover:opacity-100" title="跳转到左侧编辑器"></i>
735 </div>
736 ${!mod.editable ?
737 '<span class="locked-badge text-[10px] text-gray-400 border border-gray-200 px-1.5 py-0.5 rounded">只读 (请在左侧编辑)</span>' :
738 '<i class="fa-solid fa-chevron-down text-gray-400 text-xs"></i>'}
739 </div>
740 `;
741
742 const body = mod.editable ? `<div class="module-body p-5 border-t border-gray-50 space-y-4" id="controls-${mod.key}"></div>` : '';
743
744 card.innerHTML = header + body;
745 container.appendChild(card);
746
747 if (mod.editable) {
748 renderControls(mod);
749 }
750 });
751}
752
753// 渲染模块导航栏
754function renderModuleNav() {

Callers 1

script.jsFile · 0.85

Calls 2

renderModuleNavFunction · 0.85
renderControlsFunction · 0.85

Tested by

no test coverage detected