feat(ui): add toast notifications and more polish

- Add toast notification system with slide-in animation
- Toast types: info, success, warning, error
- Show connection status toasts on connect/disconnect
- Add toast container styling with proper z-index

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
arkon
2026-01-18 21:47:17 +01:00
co-authored by Claude Opus 4.5
parent 431732e326
commit 070c3f92e7
2 changed files with 85 additions and 0 deletions
+34
View File
@@ -414,6 +414,40 @@ class ClaudemanApp {
dot.className = 'status-dot ' + status;
text.textContent = status === 'connected' ? 'Connected' : 'Disconnected';
// Show toast on disconnect
if (status === 'disconnected') {
this.showToast('Connection lost. Reconnecting...', 'warning');
} else if (status === 'connected') {
this.showToast('Connected to server', 'success');
}
}
// Show a toast notification
showToast(message, type = 'info') {
const toast = document.createElement('div');
toast.className = `toast toast-${type}`;
toast.textContent = message;
// Create container if needed
let container = document.querySelector('.toast-container');
if (!container) {
container = document.createElement('div');
container.className = 'toast-container';
document.body.appendChild(container);
}
container.appendChild(toast);
// Animate in
requestAnimationFrame(() => {
toast.classList.add('show');
});
// Remove after delay
setTimeout(() => {
toast.classList.remove('show');
setTimeout(() => toast.remove(), 300);
}, 3000);
}
handleInit(data) {