mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-05-07 21:25:46 +00:00
feat: introduce notification system and claude notifications (#450)
* feat: introduce notification system and claude notifications * fix(sw): prevent caching of API requests and WebSocket upgrades * default to false for webpush notifications and translations for the button * fix: notifications orchestrator and add a notification when first enabled * fix: remove unused state update and dependency in settings controller hook * fix: show notifications settings tab * fix: add notifications for response completion for all providers * feat: show session name in notification and don't reload tab on clicking --- the notification --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Haileyesus <something@gmail.com>
This commit is contained in:
@@ -72,6 +72,40 @@ export default function AppContent() {
|
||||
};
|
||||
}, [openSettings]);
|
||||
|
||||
useEffect(() => {
|
||||
if (typeof navigator === 'undefined' || !('serviceWorker' in navigator)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const handleServiceWorkerMessage = (event: MessageEvent) => {
|
||||
const message = event.data;
|
||||
if (!message || message.type !== 'notification:navigate') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof message.provider === 'string' && message.provider.trim()) {
|
||||
localStorage.setItem('selected-provider', message.provider);
|
||||
}
|
||||
|
||||
setActiveTab('chat');
|
||||
setSidebarOpen(false);
|
||||
void refreshProjectsSilently();
|
||||
|
||||
if (typeof message.sessionId === 'string' && message.sessionId) {
|
||||
navigate(`/session/${message.sessionId}`);
|
||||
return;
|
||||
}
|
||||
|
||||
navigate('/');
|
||||
};
|
||||
|
||||
navigator.serviceWorker.addEventListener('message', handleServiceWorkerMessage);
|
||||
|
||||
return () => {
|
||||
navigator.serviceWorker.removeEventListener('message', handleServiceWorkerMessage);
|
||||
};
|
||||
}, [navigate, refreshProjectsSilently, setActiveTab, setSidebarOpen]);
|
||||
|
||||
// Permission recovery: query pending permissions on WebSocket reconnect or session change
|
||||
useEffect(() => {
|
||||
const isReconnect = isConnected && !wasConnectedRef.current;
|
||||
|
||||
Reference in New Issue
Block a user