- Notifications
You must be signed in to change notification settings - Fork1k
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
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 { 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-3py-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 pl-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> | ||
)} | ||
<div className="ml-auto gap-2 flex items-center"> | ||
<TooltipProvider delayDuration={250}> | ||
<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 commentThe reason will be displayed to describe this comment to others.Learn more. I agree with you, but I would create a separate issue to investigate that and make it more consistent. 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. | ||
}; |
Uh oh!
There was an error while loading.Please reload this page.