feat: refresh shared chat and server workflows

This commit is contained in:
2026-05-26 12:26:33 +09:00
parent 51e0099bea
commit c1d0f4c1db
82 changed files with 18604 additions and 12461 deletions

View File

@@ -1,23 +1,12 @@
import { Layout } from 'antd';
import { useCallback, useEffect, useMemo, useState } from 'react';
import { useEffect, useMemo, useState } from 'react';
import { Outlet, useLocation, useNavigate, useSearchParams } from 'react-router-dom';
import { useGestureLayer, useGesturePageState, useSearchLayer } from '../../../layer';
import { useAppStore } from '../../../store';
import { useTokenAccess } from '../tokenAccess';
import { syncAppConfigFromServer, useAppConfig } from '../appConfig';
import { getChatActionContextSnapshot } from '../chatActionContextStore';
import { ChatRuntimeBridgeV2 } from '../ChatRuntimeBridgeV2';
import { SystemChatPanel } from '../SystemChatPanel';
import { ScopedChatRoomsWindow, ScopedChatRoomsWindowDock } from '../ScopedChatRoomsWindow';
import {
removeMinimizedIsolatedChatRoomEntryByScope,
useActiveIsolatedChatRoomScope,
useIsolatedChatRoomsWindowOpen,
writeActiveIsolatedChatRoomScope,
writeIsolatedChatRoomsWindowOpen,
} from '../isolatedChatRoomScopeStore';
import { syncAppConfigFromServer, useAppConfig } from '../appConfig';
import { useTokenAccess } from '../tokenAccess';
import { useUnreadCounts } from '../chatV2/hooks/useUnreadCounts';
import { normalizeIsolatedChatRoomScope } from '../isolatedChatRooms';
import { matchesShortcut, isTypingTarget, scrollToElement } from '../mainView/utils';
import { MainContent } from '../MainContent';
import { MainHeader } from '../MainHeader';
@@ -120,7 +109,7 @@ function parseRoute(pathname: string): {
if (
top === 'chat' &&
(first === 'live' ||
first === 'rooms' ||
first === 'system' ||
first === 'changes' ||
first === 'resources' ||
first === 'errors' ||
@@ -254,8 +243,6 @@ export function MainLayout() {
const [searchParams] = useSearchParams();
const { currentPage, focusedComponentId, setCurrentPage, setFocusedComponentId } = useAppStore();
const { hasAccess } = useTokenAccess();
const activeScopedChatRoomScope = useActiveIsolatedChatRoomScope();
const isScopedChatRoomsWindowOpen = useIsolatedChatRoomsWindowOpen();
const appConfig = useAppConfig();
const { openSearch, setOptions: setSearchOptions } = useSearchLayer();
const layoutData = useMainLayoutData();
@@ -286,30 +273,6 @@ export function MainLayout() {
navigate(nextPath, options?.replace == null ? undefined : { replace: options.replace });
};
const openScopedChatRooms = useCallback(() => {
const actionSnapshot = getChatActionContextSnapshot();
const scope = normalizeIsolatedChatRoomScope({
topMenu: currentPage.topMenu,
menuTitle: currentPage.title,
featureTitle: actionSnapshot.featureTitle ?? focusedComponentId ?? currentPage.title,
focusedComponentId,
pageUrl: typeof window !== 'undefined' ? window.location.href : '',
selectionSummary: actionSnapshot.selectionSummary,
selectionIds: actionSnapshot.selectionIds,
sourceAppId: actionSnapshot.sourceAppId,
launchedAt: new Date().toISOString(),
});
writeActiveIsolatedChatRoomScope(scope);
removeMinimizedIsolatedChatRoomEntryByScope(scope);
if (routeState.chatMenu === 'rooms') {
writeIsolatedChatRoomsWindowOpen(false);
return;
}
writeIsolatedChatRoomsWindowOpen(true);
}, [currentPage.title, currentPage.topMenu, focusedComponentId, routeState.chatMenu]);
useEffect(() => {
void syncAppConfigFromServer();
@@ -421,20 +384,9 @@ export function MainLayout() {
openSearch();
},
},
{
id: 'mobile-middle-right-search-window',
activeStates: ['anyway'],
mobileOnly: true,
trigger: 'pull-left-middle-right' as const,
hotZoneSize: 36,
minDistance: 180,
minViewportDistanceRatio: 0.35,
maxHorizontalDrift: 72,
onTrigger: openScopedChatRooms,
},
],
}),
[isEReaderImmersiveActive, isMobileViewport, openScopedChatRooms, openSearch, routeState.docsMenu, routeState.topMenu],
[isEReaderImmersiveActive, isMobileViewport, openSearch, routeState.docsMenu, routeState.topMenu],
);
useGesturePageState('anyway');
@@ -446,11 +398,6 @@ export function MainLayout() {
return;
}
if (matchesShortcut(event, appConfig.gestureShortcuts.openWindowSearch)) {
event.preventDefault();
openScopedChatRooms();
return;
}
if (matchesShortcut(event, appConfig.gestureShortcuts.openSearch)) {
event.preventDefault();
@@ -465,9 +412,7 @@ export function MainLayout() {
};
}, [
appConfig.gestureShortcuts.openSearch,
appConfig.gestureShortcuts.openWindowSearch,
isEReaderImmersiveActive,
openScopedChatRooms,
openSearch,
]);
@@ -664,16 +609,6 @@ export function MainLayout() {
<Outlet />
</MainContent>
</Layout>
{routeState.chatMenu !== 'rooms' && isScopedChatRoomsWindowOpen ? (
<ScopedChatRoomsWindow
onClose={() => {
writeIsolatedChatRoomsWindowOpen(false);
}}
>
<SystemChatPanel lockOuterScrollOnMobile />
</ScopedChatRoomsWindow>
) : null}
{routeState.chatMenu !== 'rooms' ? <ScopedChatRoomsWindowDock /> : null}
</Layout>
</MainLayoutContextProvider>
);