// views.js — переключение видов (sidebar navigation) function switchView(viewId) { document.querySelectorAll('.view').forEach(v => v.classList.add('hidden')); const target = document.getElementById('view-' + viewId); if (target) target.classList.remove('hidden'); // Подсветка активного пункта document.querySelectorAll('.sidebar-item').forEach(el => el.classList.remove('active')); const btn = document.querySelector('.sidebar-item[data-view="' + viewId + '"]'); if (btn) btn.classList.add('active'); // Автозагрузка при открытии вида if (viewId === 'history-view' && typeof toggleHistory === 'function') { if (!historyOpen) toggleHistory(); } if (viewId === 'scenarios-view' && typeof toggleScenario === 'function') { if (!scenarioOpen) toggleScenario(); } if (viewId === 'logs-view') { // Показать лог в виде, скрыть нижнюю панель const lp = document.getElementById('log-panel'); const lvc = document.getElementById('log-view-content'); if (lp && lvc) { lvc.innerHTML = lp.innerHTML || 'Логи загружаются...'; lp.style.display = 'none'; } } else { // Скрыть нижнюю панель на всех видах кроме логов const lp = document.getElementById('log-panel'); if (lp) lp.style.display = 'none'; } }