feat(calendar): add reminder functionality for events with notifications
Some checks failed
Build & Push Docker Image / build (push) Has been cancelled
Some checks failed
Build & Push Docker Image / build (push) Has been cancelled
This commit is contained in:
@@ -77,6 +77,15 @@ export function NotificationProvider({ children }) {
|
||||
seenIds.current.add(n.id);
|
||||
const icon = notificationIcon(n.type);
|
||||
toast(`${icon} ${n.title}`, { duration: 5000 });
|
||||
// Browser notification for calendar reminders
|
||||
if (n.type === 'calendar_reminder' && 'Notification' in window) {
|
||||
const fire = () => new Notification(n.title, { body: n.body || '', icon: '/favicon.ico' });
|
||||
if (Notification.permission === 'granted') {
|
||||
fire();
|
||||
} else if (Notification.permission !== 'denied') {
|
||||
Notification.requestPermission().then(p => { if (p === 'granted') fire(); });
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch {
|
||||
/* silent – server may not be reachable */
|
||||
@@ -166,6 +175,7 @@ function notificationIcon(type) {
|
||||
case 'room_share_added': return '🔗';
|
||||
case 'room_share_removed': return '🚫';
|
||||
case 'federation_invite_received': return '📩';
|
||||
case 'calendar_reminder': return '🔔';
|
||||
default: return '🔔';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user