ФУНКЦИИ - МЕЖПРОЕКТНАЯ КОММУНИКАЦИЯ: единый realtime слой Tasker

Добавлен NODE.DC realtime event stream для workspace/project/member/invite/profile событий. Обновлены frontend stores и live controller. Доработаны settings modal, member dropdown и confirm remove под NODE.DC UX.
This commit is contained in:
DCCONSTRUCTIONS
2026-05-12 17:28:40 +03:00
parent fc59481703
commit 480f85cce8
23 changed files with 993 additions and 72 deletions
@@ -18,6 +18,7 @@ import { buildNodeDCOIDCLoginUrl, getCurrentRelativePath, shouldUseNodeDCOIDC }
import { useWorkspace } from "@/hooks/store/use-workspace";
import { useUser, useUserProfile, useUserSettings } from "@/hooks/store/user";
import { useAppRouter } from "@/hooks/use-app-router";
import { useNodeDCRealtimeEvents } from "@/hooks/use-nodedc-realtime-events";
// services
import { WorkspaceService } from "@/services/workspace.service";
@@ -64,6 +65,8 @@ export const AuthenticationWrapper = observer(function AuthenticationWrapper(pro
const shouldWatchPendingInvites =
pageType === EPageTypes.AUTHENTICATED && !!currentUser?.id && isUserOnboard && pathname !== "/invitations";
useNodeDCRealtimeEvents(pageType === EPageTypes.AUTHENTICATED && !!currentUser?.id && isUserOnboard, currentUser?.id);
const { data: pendingWorkspaceInvitations } = useSWR(
shouldWatchPendingInvites ? "USER_WORKSPACE_INVITATIONS_NOTICE" : null,
() => workspaceService.userWorkspaceInvitations(),
@@ -79,7 +82,12 @@ export const AuthenticationWrapper = observer(function AuthenticationWrapper(pro
const inviteKey = pendingWorkspaceInvitations
.map((invitation) => invitation.id)
.toSorted()
.reduce<string[]>((sortedInvitationIds, invitationId) => {
const insertAt = sortedInvitationIds.findIndex((sortedInvitationId) => sortedInvitationId > invitationId);
if (insertAt === -1) sortedInvitationIds.push(invitationId);
else sortedInvitationIds.splice(insertAt, 0, invitationId);
return sortedInvitationIds;
}, [])
.join(":");
if (pendingInviteToastKey.current === inviteKey) return;
pendingInviteToastKey.current = inviteKey;