diff --git a/site/src/modules/tasks/TasksSidebar/TasksSidebar.tsx b/site/src/modules/tasks/TasksSidebar/TasksSidebar.tsx index cbf76efcd0..8b56fe6828 100644 --- a/site/src/modules/tasks/TasksSidebar/TasksSidebar.tsx +++ b/site/src/modules/tasks/TasksSidebar/TasksSidebar.tsx @@ -3,6 +3,8 @@ import { getErrorMessage } from "api/errors"; import { cva } from "class-variance-authority"; import { Button } from "components/Button/Button"; import { CoderIcon } from "components/Icons/CoderIcon"; +import { ScrollArea } from "components/ScrollArea/ScrollArea"; +import { Skeleton } from "components/Skeleton/Skeleton"; import { Tooltip, TooltipContent, @@ -33,7 +35,7 @@ export const TasksSidebar: FC = () => { className={cn( "h-full flex flex-col flex-1 min-h-0 gap-6 bg-surface-secondary max-w-80", "border-solid border-0 border-r transition-all p-3", - { "max-w-16 items-center": isCollapsed }, + { "max-w-14": isCollapsed }, )} >
@@ -41,10 +43,7 @@ export const TasksSidebar: FC = () => { @@ -129,36 +128,34 @@ const TasksSidebarGroup: FC = ({ username }) => { }); return ( -
-
Tasks
-
- {tasksQuery.data ? ( - tasksQuery.data.length > 0 ? ( - tasksQuery.data.map((t) => ( - - )) - ) : ( + +
+
Tasks
+
+ {tasksQuery.data ? ( + tasksQuery.data.length > 0 ? ( + tasksQuery.data.map((t) => ( + + )) + ) : ( +
+ No tasks found +
+ ) + ) : tasksQuery.error ? (
- No tasks found + {getErrorMessage(tasksQuery.error, "Failed to load tasks")}
- ) - ) : tasksQuery.error ? ( -
- {getErrorMessage(tasksQuery.error, "Failed to load tasks")} -
- ) : ( -
- {Array.from({ length: 5 }).map((_, index) => ( -
- ))} -
- )} + ) : ( +
+ {Array.from({ length: 5 }).map((_, index) => ( + + ))} +
+ )} +
-
+
); }; diff --git a/site/src/pages/TaskPage/TaskPage.stories.tsx b/site/src/pages/TaskPage/TaskPage.stories.tsx index 7c165f82a9..d711c7aecc 100644 --- a/site/src/pages/TaskPage/TaskPage.stories.tsx +++ b/site/src/pages/TaskPage/TaskPage.stories.tsx @@ -2,6 +2,8 @@ import { MockFailedWorkspace, MockStartingWorkspace, MockStoppedWorkspace, + MockTasks, + MockUserOwner, MockWorkspace, MockWorkspaceAgentLogSource, MockWorkspaceAgentReady, @@ -12,6 +14,7 @@ import { mockApiError, } from "testHelpers/entities"; import { + withAuthProvider, withGlobalSnackbar, withProxyProvider, withWebSocket, @@ -30,9 +33,21 @@ import TaskPage, { data, WorkspaceDoesNotHaveAITaskError } from "./TaskPage"; const meta: Meta = { title: "pages/TaskPage", component: TaskPage, - decorators: [withProxyProvider()], + decorators: [withProxyProvider(), withAuthProvider], + beforeEach: () => { + spyOn(API.experimental, "getTasks").mockResolvedValue(MockTasks); + }, parameters: { layout: "fullscreen", + user: MockUserOwner, + reactRouter: reactRouterParameters({ + location: { + pathParams: { + workspace: MockTasks[0].workspace.name, + }, + }, + routing: { path: "/tasks/:workspace" }, + }), }, }; diff --git a/site/src/pages/TaskPage/TaskPage.tsx b/site/src/pages/TaskPage/TaskPage.tsx index f8556391da..8b8934a212 100644 --- a/site/src/pages/TaskPage/TaskPage.tsx +++ b/site/src/pages/TaskPage/TaskPage.tsx @@ -17,10 +17,17 @@ import { useWorkspaceBuildLogs } from "hooks/useWorkspaceBuildLogs"; import { ArrowLeftIcon, RotateCcwIcon } from "lucide-react"; import { AgentLogs } from "modules/resources/AgentLogs/AgentLogs"; import { useAgentLogs } from "modules/resources/useAgentLogs"; +import { TasksSidebar } from "modules/tasks/TasksSidebar/TasksSidebar"; import { AI_PROMPT_PARAMETER_NAME, type Task } from "modules/tasks/tasks"; import { WorkspaceErrorDialog } from "modules/workspaces/ErrorDialog/WorkspaceErrorDialog"; import { WorkspaceBuildLogs } from "modules/workspaces/WorkspaceBuildLogs/WorkspaceBuildLogs"; -import { type FC, type ReactNode, useLayoutEffect, useRef } from "react"; +import { + type FC, + type PropsWithChildren, + type ReactNode, + useLayoutEffect, + useRef, +} from "react"; import { Helmet } from "react-helmet-async"; import { useMutation, useQuery, useQueryClient } from "react-query"; import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels"; @@ -35,6 +42,15 @@ import { TaskApps } from "./TaskApps"; import { TaskSidebar } from "./TaskSidebar"; import { TaskTopbar } from "./TaskTopbar"; +const TaskPageLayout: FC = ({ children }) => { + return ( +
+ +
{children}
+
+ ); +}; + const TaskPage = () => { const { workspace: workspaceName, username } = useParams() as { workspace: string; @@ -54,7 +70,7 @@ const TaskPage = () => { if (error) { return ( - <> + {pageTitle("Error loading task")} @@ -81,18 +97,18 @@ const TaskPage = () => {
- + ); } if (!task) { return ( - <> + {pageTitle("Loading task")} - - + + ); } @@ -142,16 +158,14 @@ const TaskPage = () => { } return ( - <> + {pageTitle(task.workspace.name)} -
- - {content} -
- + + {content} +
); }; diff --git a/site/src/pages/TaskPage/TaskTopbar.tsx b/site/src/pages/TaskPage/TaskTopbar.tsx index 945a9fc179..1ad9ca5f0f 100644 --- a/site/src/pages/TaskPage/TaskTopbar.tsx +++ b/site/src/pages/TaskPage/TaskTopbar.tsx @@ -22,7 +22,7 @@ type TaskTopbarProps = { task: Task }; export const TaskTopbar: FC = ({ task }) => { return ( -
+