Files
vServer/Backend/admin/frontend/assets/js/ui/navigation.js
Falknat c1a781a0f5 Оптимизация
- Оптимизация JS файлов
- FIX: Исправил Crash, если не было папки logs
- Удалил скомпилированный EXE файл с репозитория исходников.
2025-11-15 23:33:57 +07:00

67 lines
2.0 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* ============================================
Navigation
Управление навигацией
============================================ */
import { $, $$, hide, show, removeClass, addClass } from '../utils/dom.js';
// Класс для управления навигацией
export class Navigation {
constructor() {
this.navItems = $$('.nav-item');
this.sections = {
services: $('sectionServices'),
sites: $('sectionSites'),
proxy: $('sectionProxy'),
settings: $('sectionSettings'),
vaccess: $('sectionVAccessEditor'),
addSite: $('sectionAddSite')
};
this.init();
}
init() {
this.navItems.forEach((item, index) => {
item.addEventListener('click', () => this.navigate(index));
});
}
navigate(index) {
// Убираем active со всех навигационных элементов
this.navItems.forEach(nav => removeClass(nav, 'active'));
addClass(this.navItems[index], 'active');
// Скрываем все секции
this.hideAllSections();
// Показываем нужные секции
if (index === 0) {
// Главная - всё кроме настроек
show(this.sections.services);
show(this.sections.sites);
show(this.sections.proxy);
} else if (index === 3) {
// Настройки
show(this.sections.settings);
// Загружаем конфигурацию при открытии
if (window.loadConfig) {
window.loadConfig();
}
}
}
hideAllSections() {
Object.values(this.sections).forEach(section => {
if (section) hide(section);
});
}
showDashboard() {
this.hideAllSections();
show(this.sections.services);
show(this.sections.sites);
show(this.sections.proxy);
}
}