diff --git a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/DashboardSidebarWorkspaceItem.tsx b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/DashboardSidebarWorkspaceItem.tsx index 9a105f0d804..4cd04e63f5d 100644 --- a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/DashboardSidebarWorkspaceItem.tsx +++ b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/DashboardSidebarWorkspaceItem.tsx @@ -38,6 +38,7 @@ export function DashboardSidebarWorkspaceItem({ cancelRename, handleClick, handleCopyPath, + handleCopyBranchName, handleCreateSection, handleDeleted, handleOpenInFinder, @@ -55,6 +56,7 @@ export function DashboardSidebarWorkspaceItem({ workspaceId: id, projectId, workspaceName: name, + branch, }); const navigate = useNavigate(); @@ -119,6 +121,7 @@ export function DashboardSidebarWorkspaceItem({ } onOpenInFinder={handleOpenInFinder} onCopyPath={handleCopyPath} + onCopyBranchName={handleCopyBranchName} onRemoveFromSidebar={() => removeWorkspaceFromSidebar(id)} onRename={startRename} onDelete={() => setIsDeleteDialogOpen(true)} @@ -183,6 +186,7 @@ export function DashboardSidebarWorkspaceItem({ isLocalWorkspace={hostType === "local-device"} onOpenInFinder={handleOpenInFinder} onCopyPath={handleCopyPath} + onCopyBranchName={handleCopyBranchName} onRemoveFromSidebar={() => removeWorkspaceFromSidebar(id)} onRename={startRename} onDelete={() => setIsDeleteDialogOpen(true)} diff --git a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/components/DashboardSidebarWorkspaceContextMenu/DashboardSidebarWorkspaceContextMenu.tsx b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/components/DashboardSidebarWorkspaceContextMenu/DashboardSidebarWorkspaceContextMenu.tsx index 49dba6a2d97..550488fc0af 100644 --- a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/components/DashboardSidebarWorkspaceContextMenu/DashboardSidebarWorkspaceContextMenu.tsx +++ b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/components/DashboardSidebarWorkspaceContextMenu/DashboardSidebarWorkspaceContextMenu.tsx @@ -22,6 +22,7 @@ import { LuCopy, LuFolderOpen, LuFolderPlus, + LuGitBranch, LuPencil, LuTrash2, LuX, @@ -38,6 +39,7 @@ interface DashboardSidebarWorkspaceContextMenuProps { onMoveToSection: (sectionId: string | null) => void; onOpenInFinder: () => void; onCopyPath: () => void; + onCopyBranchName: () => void; onRemoveFromSidebar: () => void; onRename: () => void; onDelete: () => void; @@ -54,6 +56,7 @@ export function DashboardSidebarWorkspaceContextMenu({ onMoveToSection, onOpenInFinder, onCopyPath, + onCopyBranchName, onRemoveFromSidebar, onRename, onDelete, @@ -96,6 +99,11 @@ export function DashboardSidebarWorkspaceContextMenu({ )} + {!isLocalWorkspace && } + + + Copy Branch Name + diff --git a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/hooks/useDashboardSidebarWorkspaceItemActions/useDashboardSidebarWorkspaceItemActions.ts b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/hooks/useDashboardSidebarWorkspaceItemActions/useDashboardSidebarWorkspaceItemActions.ts index a9296ede735..3eb9f4f059f 100644 --- a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/hooks/useDashboardSidebarWorkspaceItemActions/useDashboardSidebarWorkspaceItemActions.ts +++ b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/hooks/useDashboardSidebarWorkspaceItemActions/useDashboardSidebarWorkspaceItemActions.ts @@ -16,12 +16,14 @@ interface UseDashboardSidebarWorkspaceItemActionsOptions { workspaceId: string; projectId: string; workspaceName: string; + branch: string; } export function useDashboardSidebarWorkspaceItemActions({ workspaceId, projectId, workspaceName, + branch, }: UseDashboardSidebarWorkspaceItemActionsOptions) { const navigate = useNavigate(); const matchRoute = useMatchRoute(); @@ -144,10 +146,26 @@ export function useDashboardSidebarWorkspaceItemActions({ } }; + const handleCopyBranchName = async () => { + if (!branch) { + toast.error("Branch name is not available"); + return; + } + try { + await copyToClipboard(branch); + toast.success("Branch name copied"); + } catch (error) { + toast.error( + `Failed to copy branch name: ${error instanceof Error ? error.message : "Unknown error"}`, + ); + } + }; + return { cancelRename, handleClick, handleCopyPath, + handleCopyBranchName, handleCreateSection, handleDeleted, handleOpenInFinder, diff --git a/apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/CollapsedWorkspaceItem.tsx b/apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/CollapsedWorkspaceItem.tsx index c9143d9c83b..b79db133d2c 100644 --- a/apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/CollapsedWorkspaceItem.tsx +++ b/apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/CollapsedWorkspaceItem.tsx @@ -13,7 +13,7 @@ import { import { Tooltip, TooltipContent, TooltipTrigger } from "@superset/ui/tooltip"; import { cn } from "@superset/ui/utils"; import { type RefObject, useMemo, useState } from "react"; -import { LuCopy, LuX } from "react-icons/lu"; +import { LuCopy, LuGitBranch, LuX } from "react-icons/lu"; import { createContextMenuDeleteDialogCoordinator } from "renderer/react-query/workspaces/useWorkspaceDeleteHandler"; import type { ActivePaneStatus } from "shared/tabs-types"; import { STROKE_WIDTH } from "../constants"; @@ -36,6 +36,7 @@ interface CollapsedWorkspaceItemProps { onClick: () => void; onDeleteClick: () => void; onCopyPath: () => void; + onCopyBranchName: () => void; } export function CollapsedWorkspaceItem({ @@ -53,6 +54,7 @@ export function CollapsedWorkspaceItem({ onClick, onDeleteClick, onCopyPath, + onCopyBranchName, }: CollapsedWorkspaceItemProps) { const isBranchWorkspace = type === "branch"; const deleteDialogCoordinator = useMemo( @@ -92,15 +94,25 @@ export function CollapsedWorkspaceItem({ if (isBranchWorkspace) { return ( <> - - {collapsedButton} - - local - - {branch} - - - + + + + {collapsedButton} + + + local + + {branch} + + + + + + + Copy Branch Name + + + Copy Path + + + Copy Branch Name + { diff --git a/apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceContextMenu.tsx b/apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceContextMenu.tsx index 3375675ae02..5699c6fb92b 100644 --- a/apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceContextMenu.tsx +++ b/apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceContextMenu.tsx @@ -23,6 +23,7 @@ import { LuEyeOff, LuFolderOpen, LuFolderPlus, + LuGitBranch, LuMinus, LuPencil, LuX, @@ -50,6 +51,7 @@ interface WorkspaceContextMenuProps { onOpenInFinder: () => void; onOpenInEditor: () => void; onCopyPath: () => void; + onCopyBranchName: () => void; onSetUnread: (isUnread: boolean) => void; onResetStatus: () => void; onDelete: () => void; @@ -68,6 +70,7 @@ export function WorkspaceContextMenu({ onOpenInFinder, onOpenInEditor, onCopyPath, + onCopyBranchName, onSetUnread, onResetStatus, onDelete, @@ -150,6 +153,10 @@ export function WorkspaceContextMenu({ Copy Path + + + Copy Branch Name + diff --git a/apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceListItem.tsx b/apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceListItem.tsx index 9b5198060b6..c0f04b03901 100644 --- a/apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceListItem.tsx +++ b/apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceListItem.tsx @@ -243,6 +243,11 @@ export function WorkspaceListItem({ await copyToClipboard(worktreePath); toast.success("Path copied to clipboard"); }; + const handleCopyBranchName = async () => { + if (!branch) return; + await copyToClipboard(branch); + toast.success("Branch name copied to clipboard"); + }; const pr = githubStatus?.pr; const diffStats = @@ -270,6 +275,7 @@ export function WorkspaceListItem({ onClick={handleClick} onDeleteClick={handleDeleteClick} onCopyPath={handleCopyPath} + onCopyBranchName={handleCopyBranchName} /> ); } @@ -467,6 +473,7 @@ export function WorkspaceListItem({ onOpenInFinder={handleOpenInFinder} onOpenInEditor={handleOpenInEditor} onCopyPath={handleCopyPath} + onCopyBranchName={handleCopyBranchName} onSetUnread={(unread) => setUnread.mutate({ id, isUnread: unread })} onResetStatus={() => resetWorkspaceStatus(id)} onDelete={handleDeleteClick}