From a1546b54144151bca013eef122e3787e2014f83a Mon Sep 17 00:00:00 2001 From: Bruno Quaresma Date: Tue, 26 Aug 2025 12:24:52 -0300 Subject: [PATCH] refactor: replace task prompt by workspace name in the topbar (#19531) Fixes https://github.com/coder/coder/issues/19524 **Screenshot:** Screenshot 2025-08-25 at 14 59 11 **Demo:** https://github.com/user-attachments/assets/040490ea-b276-48d7-9f3a-d8261d982bb5 **Changes:** - Change "View workspace" button to icon + "Workspace" - Updated the title to use the workspace name instead of the prompt - Added a prompt button, so the user can see what is the prompt that is running + copy it easily --- site/src/pages/TaskPage/TaskPage.tsx | 6 +- site/src/pages/TaskPage/TaskTopbar.tsx | 77 ++++++++++++++++++++++---- 2 files changed, 68 insertions(+), 15 deletions(-) diff --git a/site/src/pages/TaskPage/TaskPage.tsx b/site/src/pages/TaskPage/TaskPage.tsx index 4a65c6f1be..57f6c81cff 100644 --- a/site/src/pages/TaskPage/TaskPage.tsx +++ b/site/src/pages/TaskPage/TaskPage.tsx @@ -151,7 +151,7 @@ const TaskPage = () => { return ( <> - {pageTitle(ellipsizeText(task.prompt, 64))} + {pageTitle(task.workspace.name)}
@@ -265,7 +265,3 @@ export const data = { } satisfies Task; }, }; - -const ellipsizeText = (text: string, maxLength = 80): string => { - return text.length <= maxLength ? text : `${text.slice(0, maxLength - 3)}...`; -}; diff --git a/site/src/pages/TaskPage/TaskTopbar.tsx b/site/src/pages/TaskPage/TaskTopbar.tsx index e7bc9283a1..4f51812b47 100644 --- a/site/src/pages/TaskPage/TaskTopbar.tsx +++ b/site/src/pages/TaskPage/TaskTopbar.tsx @@ -5,7 +5,14 @@ import { TooltipProvider, TooltipTrigger, } from "components/Tooltip/Tooltip"; -import { ArrowLeftIcon } from "lucide-react"; +import { useClipboard } from "hooks"; +import { + ArrowLeftIcon, + CheckIcon, + CopyIcon, + LaptopMinimalIcon, + TerminalIcon, +} from "lucide-react"; import type { Task } from "modules/tasks/tasks"; import type { FC } from "react"; import { Link as RouterLink } from "react-router"; @@ -15,7 +22,7 @@ type TaskTopbarProps = { task: Task }; export const TaskTopbar: FC = ({ task }) => { return ( -
+
@@ -30,7 +37,9 @@ export const TaskTopbar: FC = ({ task }) => { -

{task.prompt}

+

+ {task.workspace.name} +

{task.workspace.latest_app_status?.uri && (
@@ -38,13 +47,61 @@ export const TaskTopbar: FC = ({ task }) => {
)} - +
+ + + + + + +

+ {task.prompt} +

+ +
+
+
+ + +
); }; + +type CopyPromptButtonProps = { prompt: string }; + +const CopyPromptButton: FC = ({ prompt }) => { + const { copyToClipboard, showCopiedSuccess } = useClipboard({ + textToCopy: prompt, + }); + + return ( + + ); +};