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

65 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.

/* ============================================
Notification System
Система уведомлений
============================================ */
import { $, addClass, removeClass } from '../utils/dom.js';
// Класс для управления уведомлениями
export class NotificationManager {
constructor() {
this.container = $('notification');
this.loader = $('appLoader');
}
// Показать уведомление
show(message, type = 'success', duration = 1000) {
if (!this.container) return;
const icon = type === 'success'
? '<i class="fas fa-check-circle"></i>'
: '<i class="fas fa-exclamation-circle"></i>';
this.container.innerHTML = `
<div class="notification-content">
<div class="notification-icon">${icon}</div>
<div class="notification-text">${message}</div>
</div>
`;
this.container.className = `notification show ${type}`;
setTimeout(() => {
removeClass(this.container, 'show');
}, duration);
}
// Показать успешное уведомление
success(message, duration = 1000) {
this.show(message, 'success', duration);
}
// Показать уведомление об ошибке
error(message, duration = 2000) {
this.show(message, 'error', duration);
}
// Скрыть загрузчик приложения
hideLoader() {
if (!this.loader) return;
setTimeout(() => {
addClass(this.loader, 'hide');
setTimeout(() => {
if (this.loader.parentNode) {
this.loader.remove();
}
}, 500);
}, 1500);
}
}
// Глобальный экземпляр менеджера уведомлений
export const notification = new NotificationManager();