Add Copy Worktree Path in More Icon for Agent Manager (#115)

This commit is contained in:
wienans
2026-01-07 21:50:48 +02:00
committed by GitHub
parent 18c5b4c7b5
commit 6a06d57a95
@@ -4,6 +4,7 @@ import {
RiArrowDownSLine, RiArrowDownSLine,
RiCheckLine, RiCheckLine,
RiMore2Line, RiMore2Line,
RiFileCopyLine,
} from '@remixicon/react'; } from '@remixicon/react';
import { toast } from 'sonner'; import { toast } from 'sonner';
import { Button } from '@/components/ui/button'; import { Button } from '@/components/ui/button';
@@ -82,6 +83,21 @@ export const AgentGroupDetail: React.FC<AgentGroupDetailProps> = ({
// Check if the current OpenCode session matches the selected agent group session // Check if the current OpenCode session matches the selected agent group session
const isSessionSynced = selectedSession?.id === currentSessionId; const isSessionSynced = selectedSession?.id === currentSessionId;
const handleCopyWorktreePath = React.useCallback(() => {
if (!selectedSession?.path) {
toast.error('No worktree path available');
return;
}
navigator.clipboard
.writeText(selectedSession.path)
.then(() => {
toast.success('Worktree path copied');
})
.catch(() => {
toast.error('Failed to copy path');
});
}, [selectedSession?.path]);
const handleRemoveSelectedWorktree = React.useCallback(async () => { const handleRemoveSelectedWorktree = React.useCallback(async () => {
if (!selectedSession) return; if (!selectedSession) return;
setWorktreeDialog({ kind: 'remove', path: selectedSession.path, label: selectedSession.displayLabel }); setWorktreeDialog({ kind: 'remove', path: selectedSession.path, label: selectedSession.displayLabel });
@@ -234,6 +250,16 @@ export const AgentGroupDetail: React.FC<AgentGroupDetailProps> = ({
> >
Leave this one, remove others Leave this one, remove others
</DropdownMenuItem> </DropdownMenuItem>
<DropdownMenuItem
onClick={(e) => {
e.stopPropagation();
handleCopyWorktreePath();
}}
disabled={!selectedSession?.path}
>
<RiFileCopyLine className="h-4 w-4 mr-px" />
Copy Worktree Path
</DropdownMenuItem>
</DropdownMenuContent> </DropdownMenuContent>
</DropdownMenu> </DropdownMenu>
</div> </div>