mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-07 16:09:43 +02:00
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user