-
Notifications
You must be signed in to change notification settings - Fork 975
refactor: replace task prompt by workspace name in the topbar #19531
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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<TaskTopbarProps> = ({ task }) => { | ||
return ( | ||
<header className="flex items-center px-3 h-14 border-solid border-border border-0 border-b"> | ||
<header className="flex items-center px-3 py-4 border-solid border-border border-0 border-b"> | ||
<TooltipProvider> | ||
<Tooltip> | ||
<TooltipTrigger asChild> | ||
|
@@ -30,21 +37,71 @@ export const TaskTopbar: FC<TaskTopbarProps> = ({ task }) => { | |
</Tooltip> | ||
</TooltipProvider> | ||
|
||
<h1 className="m-0 text-base font-medium truncate">{task.prompt}</h1> | ||
<h1 className="m-0 ml-2 text-base font-medium truncate"> | ||
{task.workspace.name} | ||
</h1> | ||
|
||
{task.workspace.latest_app_status?.uri && ( | ||
<div className="flex items-center gap-2 flex-wrap ml-4"> | ||
<TaskStatusLink uri={task.workspace.latest_app_status.uri} /> | ||
</div> | ||
)} | ||
|
||
<Button asChild size="sm" variant="outline" className="ml-auto"> | ||
<RouterLink | ||
to={`/@${task.workspace.owner_name}/${task.workspace.name}`} | ||
> | ||
View workspace | ||
</RouterLink> | ||
</Button> | ||
<div className="ml-auto gap-2 flex items-center"> | ||
<TooltipProvider delayDuration={0}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we want the duration to be set so aggressively low? Radix's default value is 700ms |
||
<Tooltip> | ||
<TooltipTrigger asChild> | ||
<Button variant="outline" size="sm"> | ||
<TerminalIcon /> | ||
Prompt | ||
</Button> | ||
</TooltipTrigger> | ||
<TooltipContent className="max-w-xs bg-surface-secondary p-4"> | ||
<p className="m-0 mb-2 select-all text-sm font-normal text-content-primary leading-snug"> | ||
{task.prompt} | ||
</p> | ||
<CopyPromptButton prompt={task.prompt} /> | ||
</TooltipContent> | ||
</Tooltip> | ||
</TooltipProvider> | ||
|
||
<Button asChild variant="outline" size="sm"> | ||
<RouterLink | ||
to={`/@${task.workspace.owner_name}/${task.workspace.name}`} | ||
> | ||
<LaptopMinimalIcon /> | ||
Workspace | ||
</RouterLink> | ||
</Button> | ||
</div> | ||
</header> | ||
); | ||
}; | ||
|
||
type CopyPromptButtonProps = { prompt: string }; | ||
|
||
const CopyPromptButton: FC<CopyPromptButtonProps> = ({ prompt }) => { | ||
const { copyToClipboard, showCopiedSuccess } = useClipboard({ | ||
textToCopy: prompt, | ||
}); | ||
|
||
return ( | ||
<Button | ||
disabled={showCopiedSuccess} | ||
onClick={copyToClipboard} | ||
size="sm" | ||
variant="subtle" | ||
className="p-0 min-w-0" | ||
> | ||
{showCopiedSuccess ? ( | ||
<> | ||
<CheckIcon /> Copied! | ||
</> | ||
) : ( | ||
<> | ||
<CopyIcon /> Copy | ||
</> | ||
)} | ||
</Button> | ||
); | ||
Comment on lines
+88
to
+106
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In isolation, I think this is perfectly fine, but do we want to centralize the implementation for this, so we can make sure the UI stays more consistent? I'm seeing a few other buttons in the codebase that are wired up very similarly (making a call to |
||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that technically it won't be a huge deal, but could we swap the
ml-2
forpl-2
? That would reduce the risk of CSS styling side effects