roles update

This commit is contained in:
lendry
2026-06-25 15:14:50 +03:00
parent 9671fe458b
commit 1c55c871fc
21 changed files with 721 additions and 93 deletions

View File

@@ -63,6 +63,9 @@ export function NotificationBell() {
if (event.type === 'family_invite') {
showToast(event.message || 'Новое приглашение в семью');
}
if (event.type === 'role_assigned' || event.type === 'role_removed') {
showToast(event.message || 'Изменение ролей');
}
});
}, [load, showToast, subscribe]);
@@ -80,6 +83,11 @@ export function NotificationBell() {
if (payload.groupId) {
setOpen(false);
router.push(`/family/${payload.groupId}`);
return;
}
if (item.type === 'role_assigned' || item.type === 'role_removed') {
setOpen(false);
router.push('/admin');
}
}

View File

@@ -74,7 +74,12 @@ export function RealtimeProvider({ children }: { children: React.ReactNode }) {
try {
const data = JSON.parse(event.data as string) as RealtimeEvent;
emit(data);
if (data.type === 'family_invite' || (data.type === 'chat_message' && data.payload?.notificationId)) {
if (
data.type === 'family_invite' ||
data.type === 'role_assigned' ||
data.type === 'role_removed' ||
(data.type === 'chat_message' && data.payload?.notificationId)
) {
setUnreadCount((count) => count + 1);
}
} catch {