| |
| |
| |
|
|
| document.addEventListener('DOMContentLoaded', () => { |
| |
| }); |
|
|
| |
| |
| |
| |
| |
| window.showToast = function(message, type = 'error') { |
| const container = document.getElementById('toast-container'); |
| if (!container) return; |
|
|
| const toast = document.createElement('div'); |
| toast.className = 'toast'; |
| |
| |
| if (type === 'success') { |
| toast.style.backgroundColor = 'var(--color-success)'; |
| } else if (type === 'info') { |
| toast.style.backgroundColor = 'var(--color-primary)'; |
| } |
|
|
| |
| let iconClass = 'fa-circle-exclamation'; |
| if (type === 'success') iconClass = 'fa-circle-check'; |
| else if (type === 'info') iconClass = 'fa-circle-info'; |
|
|
| toast.innerHTML = ` |
| <i class="fa-solid ${iconClass}"></i> |
| <span>${message}</span> |
| `; |
|
|
| container.appendChild(toast); |
|
|
| |
| setTimeout(() => { |
| toast.style.animation = 'fadeIn 0.3s ease-in reverse forwards'; |
| setTimeout(() => toast.remove(), 300); |
| }, 3000); |
| }; |
|
|