20 lines
587 B
JavaScript
20 lines
587 B
JavaScript
// toast.js — centralized toast notification logic for dicta2stream
|
|
|
|
export function showToast(message) {
|
|
let container = document.querySelector('.toast-container');
|
|
if (!container) {
|
|
container = document.createElement('div');
|
|
container.className = 'toast-container';
|
|
document.body.appendChild(container);
|
|
}
|
|
const toast = document.createElement('div');
|
|
toast.className = 'toast';
|
|
toast.textContent = message;
|
|
container.appendChild(toast);
|
|
setTimeout(() => {
|
|
toast.remove();
|
|
// Do not remove the container; let it persist for stacking
|
|
}, 3500);
|
|
}
|
|
|