sync update from LAN repo (source dhk-1 @ 3e87be55)

This commit is contained in:
gozeros committed 2026-10-21 15:06:08 +08:00
1 parent ab6068a7c1
commit 42f2a26fa8
1482 files changed
+227759 -9584

No files matched your search

+55 -35
View File
@@ -1,10 +1,14 @@
import { useMemo, useState } from "react";
import { lazy, Suspense, useMemo, useState } from "react";
import { Navigate, Route, Routes } from "react-router-dom";
import { PageSidebar } from "@/components/page-sidebar";
import { PageSidebarDark } from "@/components/page-sidebar-dark";
import { CompactToolbox } from "@/components/workspace/compact-toolbox";
import { isChatsIframeWorkspacePath } from "@/core/page-layout/chats-iframe-route";
import { RouteLoadingFallback } from "@/components/route-loading";
import {
isChatsIframeWorkspacePath,
WX_FULL_CHAT_PATH_PREFIX,
} from "@/core/page-layout/chats-iframe-route";
import { isWujieEnv } from "@/core/embed/wujie";
import {
isEmbedActive,
@@ -22,20 +26,24 @@ import { useActiveThirdLevel } from "@/core/page-layout/use-sidebar-menu";
import { useLayoutMode } from "@/core/system-settings/hooks";
import { env } from "@/env";
import WorkspaceRoutes from "./WorkspaceRoutes";
import StrategyRoutes from "./StrategyRoutes";
import Header from "@/strategy-components/Header";
import OpenCanvasRoutes from "@/open-canvas/routes/OpenCanvasRoutes";
import RoundtableRoutes from "./RoundtableRoutes";
import NotebookRoutes from "./NotebookRoutes";
import { RoundtableJobNotifier } from "@/roundtable-planning/components/RoundtableJobNotifier";
const WorkspaceRoutes = lazy(() => import("./WorkspaceRoutes"));
const StrategyRoutes = lazy(() => import("./StrategyRoutes"));
const OpenCanvasRoutes = lazy(() => import("@/open-canvas/routes/OpenCanvasRoutes"));
const RoundtableRoutes = lazy(() => import("./RoundtableRoutes"));
const NotebookRoutes = lazy(() => import("./NotebookRoutes"));
function PageLayout() {
const [collapsed, setCollapsed] = useState(false);
const forceCollapsedSidebar = env.FORCE_COLLAPSED_SIDEBAR;
const location = useLocation();
const { theme } = useTheme();
const isDark = theme === "dark";
// This dedicated surface is self-contained: it keeps the workspace's
// common-agent panel, while omitting the global header and page navigation.
const isWxFullChat = location.pathname.startsWith(WX_FULL_CHAT_PATH_PREFIX);
// 浅色非嵌入:侧边栏为新版「二级导航图标卡片」窄栏(96px);wujie 嵌入仍走旧版手风琴(64/256px)。
const inWujie = useMemo(() => isWujieEnv(), []);
const lightNarrowSidebar = !isDark && !inWujie;
@@ -47,7 +55,13 @@ function PageLayout() {
// 不再回退到会话级 sidebarEnabled 旧默认)。「全量↔简洁」始终能真正控制顶栏+侧边栏。
const [layoutMode] = useLayoutMode();
const chromeByPreference =
forceCollapsedSidebar ? false : layoutMode === "compact" ? false : true;
forceCollapsedSidebar
? false
: isWxFullChat
? true
: layoutMode === "compact"
? false
: true;
// iframe 嵌入模式(外部系统 `&embed=1`,按标签页 sessionStorage):去掉全局导航栏 + 侧边栏,
// 只留问答/会商工作区本体。按 location 重算以跟随页内导航;非嵌入标签页恒为 false,不受影响。
const embedActive = useMemo(
@@ -90,6 +104,7 @@ function PageLayout() {
const pageSidebarAllowed =
chromeByPreference &&
!isChatsIframeWorkspacePath(location.pathname) &&
!isWxFullChat &&
!embedActive &&
!chromeHidden &&
!hostNestedSurface;
@@ -98,6 +113,7 @@ function PageLayout() {
!embedActive &&
!chromeHidden &&
!hostNestedSurface &&
!isWxFullChat &&
!isChatsIframeWorkspacePath(location.pathname);
// h-full(100%)而非 h-screen(100vh):配合 globals.css 的 html/body/#root height:100%
@@ -138,33 +154,37 @@ function PageLayout() {
: `transition-[padding] duration-300 ${collapsed ? "pl-16" : "pl-64"}`
}`}
>
<Routes>
<Route index element={<Navigate to="workspace" replace />} />
<Route
path="workspace/*"
element={
<WorkspaceRoutes
pageSidebarCollapsed={collapsed}
pageSidebarHidden={!pageSidebarAllowed}
workspaceSidebarHidden={hideChromeActive && !fullChatMode}
headerHidden={!pageSidebarAllowed || headerHidden}
// Full-chat embedding has no global PageSidebar, but it
// still needs the full GeneralQaSidebar (common agents and
// conversation history) inside the workspace.
compactWorkspaceSidebar={pageSidebarAllowed || fullChatMode}
compactActionsHidden={hideChromeActive || headerHidden}
pageSidebarDark={isDark}
forceWorkspaceSidebarCollapsed={
forceCollapsedSidebar && !fullChatMode
}
/>
}
/>
<Route path="strategy/*" element={<StrategyRoutes />} />
<Route path="canvas/*" element={<OpenCanvasRoutes />} />
<Route path="roundtable/*" element={<RoundtableRoutes />} />
<Route path="notebook/*" element={<NotebookRoutes />} />
</Routes>
<Suspense fallback={<RouteLoadingFallback />}>
<Routes>
<Route index element={<Navigate to="workspace" replace />} />
<Route
path="workspace/*"
element={
<WorkspaceRoutes
pageSidebarCollapsed={collapsed}
pageSidebarHidden={!pageSidebarAllowed}
workspaceSidebarHidden={hideChromeActive && !fullChatMode}
headerHidden={!pageSidebarAllowed || headerHidden}
// Full-chat embedding has no global PageSidebar, but it
// still needs the full GeneralQaSidebar (common agents and
// conversation history) inside the workspace.
compactWorkspaceSidebar={
pageSidebarAllowed || fullChatMode || isWxFullChat
}
compactActionsHidden={hideChromeActive || headerHidden}
pageSidebarDark={isDark}
forceWorkspaceSidebarCollapsed={
forceCollapsedSidebar && !fullChatMode
}
/>
}
/>
<Route path="strategy/*" element={<StrategyRoutes />} />
<Route path="canvas/*" element={<OpenCanvasRoutes />} />
<Route path="roundtable/*" element={<RoundtableRoutes />} />
<Route path="notebook/*" element={<NotebookRoutes />} />
</Routes>
</Suspense>
</main>
</div>
</div>