fix: polish compact workspace controls

This commit is contained in:
fengxiangdebaozi committed 2026-06-29 16:44:13 +08:00
1 parent eb61b332a2
commit 210cb5117f
13 files changed
+516 -274

No files matched your search

+45 -6
View File
@@ -5,7 +5,12 @@ import { getStoredAuth } from '@/core/auth';
import { SidebarInset, SidebarProvider } from '@/components/ui/sidebar';
import { PromptInputProvider } from '@/components/ai-elements/prompt-input';
import {
LayoutModeSwitcher,
ThemeSwitcher,
} from '@/components/workspace/appearance-controls';
import { WorkspaceSidebar } from '@/components/workspace/workspace-sidebar';
import { UserIdentityBadge } from '@/components/workspace/user-identity-badge';
import { CommandPalette } from '@/components/workspace/command-palette';
import { Toaster } from 'sonner';
import { SubtasksProvider } from '@/core/tasks/context';
@@ -72,6 +77,27 @@ function isInIframe(): boolean {
}
}
function shouldShowCompactTopActions(pathname: string): boolean {
return (
pathname === '/page/workspace/agents' ||
pathname === '/page/workspace/skills' ||
pathname === '/page/workspace/memory' ||
pathname === '/page/workspace/knowledge' ||
pathname.startsWith('/page/workspace/knowledge/')
);
}
function CompactWorkspaceTopActions() {
return (
<div className="z-[60] flex h-12 shrink-0 items-center justify-end gap-2 border-b border-border/70 bg-card/90 px-4 shadow-sm backdrop-blur-md">
<ThemeSwitcher tone="content" />
<LayoutModeSwitcher tone="content" />
<div className="bg-border/70 mx-1 h-6 w-px shrink-0" aria-hidden />
<UserIdentityBadge />
</div>
);
}
export function WorkspaceLayout({
children,
pageSidebarCollapsed,
@@ -98,7 +124,10 @@ export function WorkspaceLayout({
}) {
// 全量模式下通用问答(/page/workspace/chats*)的历史侧栏默认展开;其余紧凑页
// (如智能体对话,为聊天区更宽而默认收起)维持原默认。
const isGeneralQa = useLocation().pathname.startsWith("/page/workspace/chats");
const pathname = useLocation().pathname;
const isGeneralQa = pathname.startsWith('/page/workspace/chats');
const showCompactTopActions =
headerHidden && shouldShowCompactTopActions(pathname);
const pageSidebarWidth = pageSidebarHidden
? '0rem'
@@ -136,7 +165,14 @@ export function WorkspaceLayout({
<SidebarInset
className={cn('min-w-0', insetOverflowHidden && 'overflow-hidden')}
>
{children}
{showCompactTopActions ? (
<>
<CompactWorkspaceTopActions />
<div className="min-h-0 flex-1">{children}</div>
</>
) : (
children
)}
</SidebarInset>
<CommandPalette />
<Toaster position="top-center" />
@@ -222,7 +258,7 @@ export default function WorkspaceRoutes({
path="chats"
element={
<WorkspaceLayout {...layoutProps}>
<ChatsPage />
<ChatsPage compactChrome={headerHidden} />
</WorkspaceLayout>
}
/>
@@ -338,7 +374,10 @@ export default function WorkspaceRoutes({
path="ai-writing/*"
element={
<WorkspaceLayout {...layoutProps}>
<AIWritingPage hideAdvancedFields />
<AIWritingPage
hideAdvancedFields
compactChrome={headerHidden}
/>
</WorkspaceLayout>
}
/>
@@ -371,7 +410,7 @@ export default function WorkspaceRoutes({
element={
<WorkspaceLayout {...layoutProps}>
<ChatRuntime>
<RoundtablePlanningPage />
<RoundtablePlanningPage compactChrome={headerHidden} />
</ChatRuntime>
</WorkspaceLayout>
}
@@ -433,7 +472,7 @@ export default function WorkspaceRoutes({
path="scheduled/tasks"
element={
<WorkspaceLayout {...layoutProps}>
<ScheduledTasksPage />
<ScheduledTasksPage compactChrome={headerHidden} />
</WorkspaceLayout>
}
/>