fix(webui): keep context sidebar owned by the pane layout

This commit is contained in:
chengyongru authored and chengyongru committed 2026-11-06 13:09:44 +08:00
1 parent 5b9a4ea530
commit e4e04768d2
13 files changed
+271 -165

No files matched your search

+11 -8
View File
@@ -1,5 +1,6 @@
import { useState } from "react";
import { ThreadComposer } from "@/components/thread/ThreadComposer";
import { ComposerUsagePopover } from "@/components/thread/ComposerUsagePopover";
import type { WorkspaceScopePayload, WorkspacesPayload } from "@/lib/types";
const initialScope: WorkspaceScopePayload = { project_path: "/workspace", access_mode: "full" };
@@ -11,13 +12,15 @@ const catalog: WorkspacesPayload = {
export function WorkspaceAlignmentFixture({ parameters }: { parameters: URLSearchParams }) {
const [scope, setScope] = useState(initialScope);
return <main className="mx-auto w-full max-w-5xl px-4 pt-24" style={{ maxWidth: parameters.has("containerWidth") ? Number(parameters.get("containerWidth")) : undefined }}>
<ThreadComposer variant={parameters.get("composerVariant") === "thread" ? "thread" : "hero"}
onSend={() => {}} workspaceScope={scope} workspaceDefaultScope={initialScope}
contextUsage={parameters.has("usage") ? { contextTokens: 500, contextWindowTokens: 1000 } : null}
workspaceControls={catalog.controls} onWorkspaceScopeChange={setScope}
onLoadWorkspaceProjects={async () => catalog}
onResolveWorkspaceProject={async path => ({ path, name: "workspace" })}
onFavoriteWorkspaceProject={async () => []}
onBrowseWorkspaceDirectories={async path => ({ path, parent: null, entries: [], truncated: false, host: "fixture", platform: "Linux" })} />
<ComposerUsagePopover context={parameters.has("usage") ? { contextTokens: 500, contextWindowTokens: 1000 } : null} rounds={[]}>
{(renderContextUsage) => <ThreadComposer variant={parameters.get("composerVariant") === "thread" ? "thread" : "hero"}
onSend={() => {}} workspaceScope={scope} workspaceDefaultScope={initialScope}
renderContextUsage={renderContextUsage}
workspaceControls={catalog.controls} onWorkspaceScopeChange={setScope}
onLoadWorkspaceProjects={async () => catalog}
onResolveWorkspaceProject={async path => ({ path, name: "workspace" })}
onFavoriteWorkspaceProject={async () => []}
onBrowseWorkspaceDirectories={async path => ({ path, parent: null, entries: [], truncated: false, host: "fixture", platform: "Linux" })} />}
</ComposerUsagePopover>
</main>;
}