| |
|
|
| function switchView(viewId, element) { |
| |
| document.querySelectorAll('.view-container').forEach(v => { |
| v.classList.remove('active'); |
| |
| v.style.display = 'none'; |
| }); |
| |
| |
| const target = document.getElementById(viewId); |
| if(target) { |
| target.style.display = 'flex'; |
| |
| void target.offsetWidth; |
| target.classList.add('active'); |
| } |
| |
| |
| document.querySelectorAll('.nav-item').forEach(n => n.classList.remove('active')); |
| if(element) element.classList.add('active'); |
| |
| |
| if(window.innerWidth <= 768) { |
| document.getElementById('sidebar').classList.remove('open'); |
| } |
| |
| |
| if(viewId === 'terminal-view') { |
| const termInput = document.getElementById('terminal-input'); |
| if(termInput) termInput.focus(); |
| } |
| } |
|
|