Skip to content

The open-source app everyone uses to manage agents at work

Make worktree banner name clickable to copy to clipboard

dottadb1279dc1292
diff --git a/ui/src/components/WorktreeBanner.tsx b/ui/src/components/WorktreeBanner.tsx
index 6808b2da4c..e256c406cd 100644
--- a/ui/src/components/WorktreeBanner.tsx
+++ b/ui/src/components/WorktreeBanner.tsx
@@ -1,7 +1,18 @@
+import { useCallback, useState } from "react";
import { getWorktreeUiBranding } from "../lib/worktree-branding";
export function WorktreeBanner() {
const branding = getWorktreeUiBranding();
+ const [copied, setCopied] = useState(false);
+
+ const handleCopyName = useCallback(() => {
+ if (!branding) return;
+ navigator.clipboard.writeText(branding.name).then(() => {
+ setCopied(true);
+ setTimeout(() => setCopied(false), 1500);
+ });
+ }, [branding]);
+
if (!branding) return null;
return (
@@ -18,7 +29,14 @@ export function WorktreeBanner() {
<div className="flex items-center gap-2 overflow-hidden whitespace-nowrap">
<span className="shrink-0 opacity-70">Worktree</span>
<span className="h-1.5 w-1.5 shrink-0 rounded-full bg-current opacity-70" aria-hidden="true" />
- <span className="truncate font-semibold tracking-[0.12em]">{branding.name}</span>
+ <button
+ type="button"
+ onClick={handleCopyName}
+ title="Click to copy worktree name"
+ className="truncate font-semibold tracking-[0.12em] cursor-pointer hover:opacity-80 transition-opacity bg-transparent border-none p-0 text-current uppercase text-[11px]"
+ >
+ {copied ? "Copied!" : branding.name}
+ </button>
</div>
</div>
);