File size: 1,293 Bytes
28b723d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | /**
* Main application scripts
*/
document.addEventListener('DOMContentLoaded', () => {
// Other initializations can go here if needed in the future
});
/**
* Show a toast notification
* @param {string} message - The message to display
* @param {string} type - 'success', 'error', 'info'
*/
window.showToast = function(message, type = 'error') {
const container = document.getElementById('toast-container');
if (!container) return;
const toast = document.createElement('div');
toast.className = 'toast';
// Set color based on type
if (type === 'success') {
toast.style.backgroundColor = 'var(--color-success)';
} else if (type === 'info') {
toast.style.backgroundColor = 'var(--color-primary)';
}
// Set icon based on type
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);
// Remove after 3 seconds
setTimeout(() => {
toast.style.animation = 'fadeIn 0.3s ease-in reverse forwards';
setTimeout(() => toast.remove(), 300);
}, 3000);
};
|