From 13449b9e78c06b0684843137e840d1351e5ec8dd Mon Sep 17 00:00:00 2001 From: Bruno Quaresma Date: Tue, 3 Jun 2025 17:00:59 -0300 Subject: [PATCH] feat: embed chat ui in the task sidebar (#18216) **Demo:** Screenshot 2025-06-03 at 14 36 25 - Extract components to be reused and easier to reasoning about - When having cloude-code-web, embed the chat in the sidebar - The sidebar will be wider when having the chat to better fit that **Does not include:** - Sidebar width drag and drop control. The width is static but would be nice to have a control to customize it. --- site/src/pages/TaskPage/TaskAppIframe.tsx | 40 +++ site/src/pages/TaskPage/TaskApps.tsx | 169 +++++++++ site/src/pages/TaskPage/TaskPage.tsx | 396 +--------------------- site/src/pages/TaskPage/TaskSidebar.tsx | 230 +++++++++++++ site/src/pages/TaskPage/constants.ts | 1 + 5 files changed, 445 insertions(+), 391 deletions(-) create mode 100644 site/src/pages/TaskPage/TaskAppIframe.tsx create mode 100644 site/src/pages/TaskPage/TaskApps.tsx create mode 100644 site/src/pages/TaskPage/TaskSidebar.tsx create mode 100644 site/src/pages/TaskPage/constants.ts diff --git a/site/src/pages/TaskPage/TaskAppIframe.tsx b/site/src/pages/TaskPage/TaskAppIframe.tsx new file mode 100644 index 0000000000..1f247bfeaa --- /dev/null +++ b/site/src/pages/TaskPage/TaskAppIframe.tsx @@ -0,0 +1,40 @@ +import type { WorkspaceApp } from "api/typesGenerated"; +import { useAppLink } from "modules/apps/useAppLink"; +import type { Task } from "modules/tasks/tasks"; +import type { FC } from "react"; +import { cn } from "utils/cn"; + +type TaskAppIFrameProps = { + task: Task; + app: WorkspaceApp; + active: boolean; +}; + +export const TaskAppIFrame: FC = ({ + task, + app, + active, +}) => { + const agent = task.workspace.latest_build.resources + .flatMap((r) => r.agents) + .filter((a) => !!a) + .find((a) => a.apps.some((a) => a.id === app.id)); + + if (!agent) { + throw new Error(`Agent for app ${app.id} not found in task workspace`); + } + + const link = useAppLink(app, { + agent, + workspace: task.workspace, + }); + + return ( +