feat: enhance export and import workflows with improved error handling and notifications

This commit is contained in:
2025-11-10 18:44:42 +01:00
parent 43b1e53837
commit e2465188c2
6 changed files with 127 additions and 13 deletions

View File

@@ -0,0 +1,38 @@
(() => {
let container;
function ensureContainer() {
if (!container) {
container = document.createElement("div");
container.className = "toast-container";
document.body.appendChild(container);
}
return container;
}
function show({ message, level = "info", timeout = 5000 } = {}) {
const root = ensureContainer();
const toast = document.createElement("div");
toast.className = `toast toast--${level}`;
toast.setAttribute("role", "alert");
toast.innerHTML = `
<span class="toast__icon" aria-hidden="true"></span>
<p class="toast__message">${message}</p>
<button type="button" class="toast__close" aria-label="Dismiss">×</button>
`;
root.appendChild(toast);
const close = () => {
toast.classList.add("hidden");
setTimeout(() => toast.remove(), 200);
};
toast.querySelector(".toast__close").addEventListener("click", close);
if (timeout > 0) {
setTimeout(close, timeout);
}
}
window.NotificationCenter = { show };
})();