@devries-cameron20 / t3code Mirror · read-only / commits / d430a0624b
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 25, 07:30 UTC

Add copy workspace path button to thread action menu (#1128)

James committed Mar 17, 2026 at 16:34 UTC d430a0624b570561a4d8eedc7c277fb6c31c46e1
1 file changed +44 -6
apps/web/src/components/Sidebar.tsx
+44 -6
@@ -561,7 +561,6 @@ export default function Sidebar() {
561 if (!api) return;
562 const thread = threads.find((t) => t.id === threadId);
563 if (!thread) return;
564 -
564 const threadProject = projects.find((project) => project.id === thread.projectId);
565 // When bulk-deleting, exclude the other threads being deleted so
566 // getOrphanedWorktreePathForThread correctly detects that no surviving
@@ -665,7 +664,7 @@ export default function Sidebar() {
664 ],
665 );
666
668 - const { copyToClipboard } = useCopyToClipboard<{ threadId: ThreadId }>({
667 + const { copyToClipboard: copyThreadIdToClipboard } = useCopyToClipboard<{ threadId: ThreadId }>({
668 onCopy: (ctx) => {
669 toastManager.add({
670 type: "success",
@@ -681,21 +680,40 @@ export default function Sidebar() {
680 });
681 },
682 });
683 + const { copyToClipboard: copyPathToClipboard } = useCopyToClipboard<{ path: string }>({
684 + onCopy: (ctx) => {
685 + toastManager.add({
686 + type: "success",
687 + title: "Path copied",
688 + description: ctx.path,
689 + });
690 + },
691 + onError: (error) => {
692 + toastManager.add({
693 + type: "error",
694 + title: "Failed to copy path",
695 + description: error instanceof Error ? error.message : "An error occurred.",
696 + });
697 + },
698 + });
699 const handleThreadContextMenu = useCallback(
700 async (threadId: ThreadId, position: { x: number; y: number }) => {
701 const api = readNativeApi();
702 if (!api) return;
703 + const thread = threads.find((t) => t.id === threadId);
704 + if (!thread) return;
705 + const threadWorkspacePath =
706 + thread.worktreePath ?? projectCwdById.get(thread.projectId) ?? null;
707 const clicked = await api.contextMenu.show(
708 [
709 { id: "rename", label: "Rename thread" },
710 { id: "mark-unread", label: "Mark unread" },
711 + { id: "copy-path", label: "Copy Path" },
712 { id: "copy-thread-id", label: "Copy Thread ID" },
713 { id: "delete", label: "Delete", destructive: true },
714 ],
715 position,
716 );
697 - const thread = threads.find((t) => t.id === threadId);
698 - if (!thread) return;
717
718 if (clicked === "rename") {
719 setRenamingThreadId(threadId);
@@ -708,8 +726,20 @@ export default function Sidebar() {
726 markThreadUnread(threadId);
727 return;
728 }
729 + if (clicked === "copy-path") {
730 + if (!threadWorkspacePath) {
731 + toastManager.add({
732 + type: "error",
733 + title: "Path unavailable",
734 + description: "This thread does not have a workspace path to copy.",
735 + });
736 + return;
737 + }
738 + copyPathToClipboard(threadWorkspacePath, { path: threadWorkspacePath });
739 + return;
740 + }
741 if (clicked === "copy-thread-id") {
712 - copyToClipboard(threadId, { threadId });
742 + copyThreadIdToClipboard(threadId, { threadId });
743 return;
744 }
745 if (clicked !== "delete") return;
@@ -726,7 +756,15 @@ export default function Sidebar() {
756 }
757 await deleteThread(threadId);
758 },
729 - [appSettings.confirmThreadDelete, copyToClipboard, deleteThread, markThreadUnread, threads],
759 + [
760 + appSettings.confirmThreadDelete,
761 + copyPathToClipboard,
762 + copyThreadIdToClipboard,
763 + deleteThread,
764 + markThreadUnread,
765 + projectCwdById,
766 + threads,
767 + ],
768 );
769
770 const handleMultiSelectContextMenu = useCallback(