(message, type = "info")
| 108 | |
| 109 | // ===== TOAST NOTIFICATIONS ===== |
| 110 | function showToast(message, type = "info") { |
| 111 | const container = document.getElementById("toastContainer"); |
| 112 | const toast = document.createElement("div"); |
| 113 | toast.className = `toast toast-${type}`; |
| 114 | toast.innerHTML = ` |
| 115 | <span class="toast-dot"></span> |
| 116 | <span class="toast-msg">${message}</span> |
| 117 | <button class="toast-close" aria-label="Close">×</button> |
| 118 | `; |
| 119 | toast.querySelector(".toast-close").addEventListener("click", () => { |
| 120 | dismissToast(toast); |
| 121 | }); |
| 122 | container.appendChild(toast); |
| 123 | |
| 124 | requestAnimationFrame(() => { |
| 125 | requestAnimationFrame(() => toast.classList.add("show")); |
| 126 | }); |
| 127 | |
| 128 | setTimeout(() => dismissToast(toast), 5000); |
| 129 | } |
| 130 | |
| 131 | function dismissToast(toast) { |
| 132 | toast.classList.remove("show"); |
no test coverage detected