diff --git a/packages/ui/src/components/sections/openchamber/NotificationSettings.tsx b/packages/ui/src/components/sections/openchamber/NotificationSettings.tsx index ee5fad69..0411fdbf 100644 --- a/packages/ui/src/components/sections/openchamber/NotificationSettings.tsx +++ b/packages/ui/src/components/sections/openchamber/NotificationSettings.tsx @@ -385,6 +385,31 @@ export const NotificationSettings: React.FC = () => { }; }; + const handleTestNotification = async () => { + const apis = getRegisteredRuntimeAPIs(); + if (!apis?.notifications) { + toast.error('Notifications API not available'); + return; + } + + try { + const success = await apis.notifications.notifyAgentCompletion({ + title: 'Test Notification', + body: 'This is a test notification from OpenChamber.', + tag: 'openchamber-test', + }); + + if (success) { + toast.success('Test notification sent successfully'); + } else { + toast.error('Failed to send test notification'); + } + } catch (error) { + console.error('Test notification failed:', error); + toast.error('Failed to send test notification'); + } + }; + const handleEnableBackgroundNotifications = async () => { if (!pushSupported) { toast.error('Push notifications not supported'); @@ -547,26 +572,39 @@ export const NotificationSettings: React.FC = () => { {nativeNotificationsEnabled && canShowNotifications && ( -
setNotificationMode(notificationMode === 'always' ? 'hidden-only' : 'always')} - onKeyDown={(event) => { - if (event.key === ' ' || event.key === 'Enter') { - event.preventDefault(); - setNotificationMode(notificationMode === 'always' ? 'hidden-only' : 'always'); - } - }} - > - setNotificationMode(checked ? 'always' : 'hidden-only')} - ariaLabel="Notify while app is focused" - /> - Notify While App is Focused -
+ <> +
setNotificationMode(notificationMode === 'always' ? 'hidden-only' : 'always')} + onKeyDown={(event) => { + if (event.key === ' ' || event.key === 'Enter') { + event.preventDefault(); + setNotificationMode(notificationMode === 'always' ? 'hidden-only' : 'always'); + } + }} + > + setNotificationMode(checked ? 'always' : 'hidden-only')} + ariaLabel="Notify while app is focused" + /> + Notify While App is Focused +
+ +
+ +
+ )}