Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions site/src/pages/TaskPage/TaskPage.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
MockDeletedWorkspace,
MockDisplayNameTasks,
MockFailedWorkspace,
MockStartingWorkspace,
MockStoppedWorkspace,
Expand Down Expand Up @@ -561,6 +562,38 @@ export const WorkspaceStartFailureWithDialog: Story = {
},
};

const longDisplayName =
"Implement comprehensive authentication and authorization system with role-based access control";
export const LongDisplayName: Story = {
parameters: {
queries: [
{
// Sidebar: uses getTasks() which returns an array
key: ["tasks", { owner: MockTask.owner_name }],
data: [
{ ...MockDisplayNameTasks[0], display_name: longDisplayName },
...MockDisplayNameTasks.slice(1),
],
},
{
// TaskTopbar: uses getTask() which returns a single task
key: ["tasks", MockTask.owner_name, MockTask.id],
data: { ...MockDisplayNameTasks[0], display_name: longDisplayName },
},
{
// Workspace data for the task
key: [
"workspace",
MockTask.owner_name,
MockTask.workspace_name,
"settings",
],
data: MockWorkspace,
},
],
},
};

function mockTaskWithWorkspace(
sidebarApp: WorkspaceApp,
activeApp: WorkspaceApp,
Expand Down
6 changes: 4 additions & 2 deletions site/src/pages/TaskPage/TaskTopbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type TaskTopbarProps = { task: Task; workspace: Workspace };

export const TaskTopbar: FC<TaskTopbarProps> = ({ task, workspace }) => {
return (
<header className="flex flex-shrink-0 items-center p-3 border-solid border-border border-0 border-b">
<header className="flex flex-shrink-0 items-center gap-2 p-3 border-solid border-border border-0 border-b">
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
Expand All @@ -38,7 +38,9 @@ export const TaskTopbar: FC<TaskTopbarProps> = ({ task, workspace }) => {
</Tooltip>
</TooltipProvider>

<h1 className="m-0 pl-2 text-base font-medium truncate">{task.name}</h1>
<h1 className="m-0 pl-2 text-base font-medium max-w-[520px] truncate">
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just defaulting to the same value as in the Tasks list view. In the backend, we also always guarantee that the display name is only 64 characters, which should not reach this maximum.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<h1 className="m-0 pl-2 text-base font-medium max-w-[520px] truncate">
<h1 className="m-0 pl-2 text-base font-medium max-w-[64ch] truncate">

We talked about this during our chat, unsure if we do this pattern elsewhere but it might look less magic to someone reading in the future

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed on Slack, it looks like this doesn’t exactly meet the 64-characters, which leads to the page width expanding, which isn’t ideal 🙁

{task.display_name}
</h1>

{task.current_state?.uri && (
<div className="flex items-center gap-2 flex-wrap ml-4">
Expand Down
4 changes: 2 additions & 2 deletions site/src/testHelpers/entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4971,8 +4971,8 @@ export const MockAIPromptPresets: TypesGen.Preset[] = [

export const MockTask = {
id: "test-task",
name: "wild-test-123",
display_name: "Task wild test",
name: "perform-some-task-123",
display_name: "Perform some task",
organization_id: MockOrganization.id,
owner_id: MockUserOwner.id,
owner_name: MockUserOwner.username,
Expand Down
Loading