Update conversations.php

This commit is contained in:
Lizandro Guarnizo
2026-01-23 23:32:37 -05:00
parent 349f326c65
commit 4e56e44ab5
+9 -2
View File
@@ -712,7 +712,11 @@
const icon = type === 'success' ? '✅' : (type === 'danger' ? '⚠️' : (type === 'warning' ? '⚠' : '️'));
toast.innerHTML = `<span class="nt-icon">${icon}</span><div style="flex:1; font-size:13px">${message}</div>`;
container.appendChild(toast);
setTimeout(() => { if (toast.parentNode) toast.remove(); }, type === 'success' ? 4000 : 8000);
// Ensure a sensible minimum duration (3s) so very short toasts don't disappear instantly
const _minToastDuration = 3000;
let _dur = (type === 'success') ? 4000 : 8000;
_dur = Math.max(_dur, _minToastDuration);
setTimeout(() => { if (toast.parentNode) toast.remove(); }, _dur);
} catch (e) {
// fallback to alert if DOM fails
try { alert(message); } catch (e2) { /* ignore */ }
@@ -839,7 +843,10 @@
container.appendChild(toast);
// Auto remove (shorter for compact notifications)
const timeout = notification.cool ? 15000 : 8000;
const _minToastDuration = 3000;
let timeout = notification.duration ? Number(notification.duration) : (notification.cool ? 15000 : 8000);
if (!isFinite(timeout) || timeout <= 0) timeout = (notification.cool ? 15000 : 8000);
timeout = Math.max(timeout, _minToastDuration);
setTimeout(() => { if (toast.parentNode) toast.remove(); }, timeout);
}