页面结构调整

This commit is contained in:
fengxiangdebaozi committed 2026-05-14 09:42:12 +08:00
1 parent 65e89a4248
commit e286e59431
2 files changed
+27 -10

No files matched your search

+7 -2
View File
@@ -21,14 +21,19 @@ function PageLayout() {
)} )}
<main <main
className={`min-h-screen transition-[padding] duration-300 ${ className={`min-h-screen transition-[padding] duration-300 ${
SIDEBAR_ENABLED && !collapsed ? "pl-16 md:pl-64" : "pl-16" !SIDEBAR_ENABLED ? "" : collapsed ? "pl-16" : "pl-16 md:pl-64"
}`} }`}
> >
<Routes> <Routes>
<Route index element={<Navigate to="workspace" replace />} /> <Route index element={<Navigate to="workspace" replace />} />
<Route <Route
path="workspace/*" path="workspace/*"
element={<WorkspaceRoutes pageSidebarCollapsed={collapsed} />} element={
<WorkspaceRoutes
pageSidebarCollapsed={collapsed}
pageSidebarHidden={!SIDEBAR_ENABLED}
/>
}
/> />
</Routes> </Routes>
</main> </main>
+20 -8
View File
@@ -20,16 +20,24 @@ import ScheduledTasksPage from "./ScheduledTasksPage";
function WorkspaceLayout({ function WorkspaceLayout({
children, children,
pageSidebarCollapsed, pageSidebarCollapsed,
pageSidebarHidden = false,
}: { }: {
children: ReactNode; children: ReactNode;
pageSidebarCollapsed: boolean; pageSidebarCollapsed: boolean;
pageSidebarHidden?: boolean;
}) { }) {
const pageSidebarWidth = pageSidebarHidden
? "0rem"
: pageSidebarCollapsed
? "4rem"
: "16rem";
return ( return (
<SidebarProvider <SidebarProvider
className="h-screen w-full overflow-x-hidden [&_[data-slot=sidebar-container]]:left-[var(--page-sidebar-width)]" className="h-screen w-full overflow-x-hidden [&_[data-slot=sidebar-container]]:left-[var(--page-sidebar-width)]"
style={ style={
{ {
"--page-sidebar-width": pageSidebarCollapsed ? "4rem" : "16rem", "--page-sidebar-width": pageSidebarWidth,
} as CSSProperties } as CSSProperties
} }
// Keep the fixed workspace sidebar aligned to the outer page sidebar width. // Keep the fixed workspace sidebar aligned to the outer page sidebar width.
@@ -57,16 +65,20 @@ function ChatRuntime({ children }: { children: ReactNode }) {
export default function WorkspaceRoutes({ export default function WorkspaceRoutes({
pageSidebarCollapsed = false, pageSidebarCollapsed = false,
pageSidebarHidden = false,
}: { }: {
pageSidebarCollapsed?: boolean; pageSidebarCollapsed?: boolean;
pageSidebarHidden?: boolean;
}) { }) {
const layoutProps = { pageSidebarCollapsed, pageSidebarHidden };
return ( return (
<Routes> <Routes>
<Route index element={<Navigate to="chats/new" replace />} /> <Route index element={<Navigate to="chats/new" replace />} />
<Route <Route
path="chats" path="chats"
element={ element={
<WorkspaceLayout pageSidebarCollapsed={pageSidebarCollapsed}> <WorkspaceLayout {...layoutProps}>
<ChatsPage /> <ChatsPage />
</WorkspaceLayout> </WorkspaceLayout>
} }
@@ -74,7 +86,7 @@ export default function WorkspaceRoutes({
<Route <Route
path="chats/:thread_id" path="chats/:thread_id"
element={ element={
<WorkspaceLayout pageSidebarCollapsed={pageSidebarCollapsed}> <WorkspaceLayout {...layoutProps}>
<ChatRuntime> <ChatRuntime>
<ChatPage /> <ChatPage />
</ChatRuntime> </ChatRuntime>
@@ -84,7 +96,7 @@ export default function WorkspaceRoutes({
<Route <Route
path="agents" path="agents"
element={ element={
<WorkspaceLayout pageSidebarCollapsed={pageSidebarCollapsed}> <WorkspaceLayout {...layoutProps}>
<AgentsPage /> <AgentsPage />
</WorkspaceLayout> </WorkspaceLayout>
} }
@@ -92,7 +104,7 @@ export default function WorkspaceRoutes({
<Route <Route
path="agents/new" path="agents/new"
element={ element={
<WorkspaceLayout pageSidebarCollapsed={pageSidebarCollapsed}> <WorkspaceLayout {...layoutProps}>
<NewAgentPage /> <NewAgentPage />
</WorkspaceLayout> </WorkspaceLayout>
} }
@@ -104,7 +116,7 @@ export default function WorkspaceRoutes({
<Route <Route
path="agents/:agent_id/chats/:thread_id" path="agents/:agent_id/chats/:thread_id"
element={ element={
<WorkspaceLayout pageSidebarCollapsed={pageSidebarCollapsed}> <WorkspaceLayout {...layoutProps}>
<ChatRuntime> <ChatRuntime>
<AgentChatPage /> <AgentChatPage />
</ChatRuntime> </ChatRuntime>
@@ -118,7 +130,7 @@ export default function WorkspaceRoutes({
<Route <Route
path="scheduled/tasks" path="scheduled/tasks"
element={ element={
<WorkspaceLayout pageSidebarCollapsed={pageSidebarCollapsed}> <WorkspaceLayout {...layoutProps}>
<ScheduledTasksPage /> <ScheduledTasksPage />
</WorkspaceLayout> </WorkspaceLayout>
} }
@@ -126,7 +138,7 @@ export default function WorkspaceRoutes({
<Route <Route
path="scheduled/runs/:run_id" path="scheduled/runs/:run_id"
element={ element={
<WorkspaceLayout pageSidebarCollapsed={pageSidebarCollapsed}> <WorkspaceLayout {...layoutProps}>
<ScheduledTaskRunDetailPage /> <ScheduledTaskRunDetailPage />
</WorkspaceLayout> </WorkspaceLayout>
} }