diff --git a/src/renderer/src/components/right-sidebar/AiVaultSessionRow.tsx b/src/renderer/src/components/right-sidebar/AiVaultSessionRow.tsx index c6b209b02..fe2e07bc3 100644 --- a/src/renderer/src/components/right-sidebar/AiVaultSessionRow.tsx +++ b/src/renderer/src/components/right-sidebar/AiVaultSessionRow.tsx @@ -43,6 +43,7 @@ export function VaultSessionRow({ resumeDisabled, onToggleDetails, onJumpToOriginalPane, + showJumpToWorktree, onJumpToWorktree, onResume, resumeLabel, @@ -63,6 +64,7 @@ export function VaultSessionRow({ resumeDisabled: boolean onToggleDetails: () => void onJumpToOriginalPane?: () => void + showJumpToWorktree: boolean onJumpToWorktree?: () => void onResume: () => void resumeLabel: string @@ -146,6 +148,7 @@ export function VaultSessionRow({ worktreeInfo={worktreeInfo} onToggleDetails={onToggleDetails} onJumpToOriginalPane={onJumpToOriginalPane} + showJumpToWorktree={showJumpToWorktree} onJumpToWorktree={onJumpToWorktree} onResume={onResume} onCopyResume={onCopyResume} @@ -204,6 +207,7 @@ export function VaultSessionRow({ resumeDisabled={resumeDisabled} resumeLabel={resumeLabel} onJumpToOriginalPane={onJumpToOriginalPane} + showJumpToWorktree={showJumpToWorktree} onJumpToWorktree={onJumpToWorktree} onResume={onResume} onCopyResume={onCopyResume} @@ -224,6 +228,7 @@ export function SessionActionMenuItems({ resumeLabel, onResume, onJumpToOriginalPane, + showJumpToWorktree, onJumpToWorktree, onCopyResume, onCopyId, @@ -237,6 +242,7 @@ export function SessionActionMenuItems({ resumeLabel: string onResume: () => void onJumpToOriginalPane?: () => void + showJumpToWorktree: boolean onJumpToWorktree?: () => void onCopyResume: () => void onCopyId: () => void @@ -259,13 +265,15 @@ export function SessionActionMenuItems({ )} ) : null} - - - {translate( - 'auto.components.right.sidebar.AiVaultSessionRow.jumpToWorktree', - 'Jump to Worktree' - )} - + {showJumpToWorktree ? ( + + + {translate( + 'auto.components.right.sidebar.AiVaultSessionRow.jumpToWorktree', + 'Jump to Worktree' + )} + + ) : null} {resumeLabel} diff --git a/src/renderer/src/components/right-sidebar/AiVaultSessionVirtualList.tsx b/src/renderer/src/components/right-sidebar/AiVaultSessionVirtualList.tsx index bac36ba8a..e7293f15d 100644 --- a/src/renderer/src/components/right-sidebar/AiVaultSessionVirtualList.tsx +++ b/src/renderer/src/components/right-sidebar/AiVaultSessionVirtualList.tsx @@ -16,6 +16,7 @@ import { } from './ai-vault-session-resume' import { canJumpToAiVaultSessionWorktree, + isAiVaultSessionInCurrentWorktree, type AiVaultSessionWorktreeInfo } from './ai-vault-session-worktree' import { @@ -263,9 +264,14 @@ function AiVaultVirtualRow({ const isActiveStickyHeader = row.type === 'group' && activeStickyHeaderIndex === index const originalPaneTarget = row.type === 'session' ? getOriginalPaneTarget(row.session) : null const worktreeInfo = row.type === 'session' ? getWorktreeInfo(row.session) : null - const worktreeJumpId = canJumpToAiVaultSessionWorktree(worktreeInfo) - ? worktreeInfo?.worktreeId - : null + // Why: omit the jump affordance when the session already lives in the + // worktree on screen — jumping there is a no-op the "Current worktree" badge + // already conveys. + const showJumpToWorktree = !isAiVaultSessionInCurrentWorktree(worktreeInfo) + const worktreeJumpId = + showJumpToWorktree && canJumpToAiVaultSessionWorktree(worktreeInfo) + ? worktreeInfo?.worktreeId + : null const resumeState = row.type === 'session' ? getSessionResumeState(row.session) : null const resumeActions = row.type === 'session' ? getSessionResumeActions(row.session) : null const resumeLabel = resumeState ? aiVaultSessionResumeLabel(resumeState) : '' @@ -304,6 +310,7 @@ function AiVaultVirtualRow({ onJumpToOriginalPane={ originalPaneTarget ? () => onJumpToOriginalPane(row.session) : undefined } + showJumpToWorktree={showJumpToWorktree} onJumpToWorktree={worktreeJumpId ? () => onJumpToWorktree(worktreeJumpId) : undefined} onResume={() => { if (resumeState?.worktreeId) { diff --git a/src/renderer/src/components/right-sidebar/SessionRowTrailingActions.tsx b/src/renderer/src/components/right-sidebar/SessionRowTrailingActions.tsx index ad104e505..27a29bbf0 100644 --- a/src/renderer/src/components/right-sidebar/SessionRowTrailingActions.tsx +++ b/src/renderer/src/components/right-sidebar/SessionRowTrailingActions.tsx @@ -42,6 +42,7 @@ export function SessionRowTrailingActions({ worktreeInfo, onToggleDetails, onJumpToOriginalPane, + showJumpToWorktree, onJumpToWorktree, onResume, onCopyResume, @@ -60,6 +61,7 @@ export function SessionRowTrailingActions({ worktreeInfo: AiVaultSessionWorktreeInfo | null onToggleDetails: () => void onJumpToOriginalPane?: () => void + showJumpToWorktree: boolean onJumpToWorktree?: () => void onResume: () => void onCopyResume: () => void @@ -109,16 +111,18 @@ export function SessionRowTrailingActions({ ) : null} - - - - {jumpToWorktreeTooltip} - - + {showJumpToWorktree ? ( + + + + {jumpToWorktreeTooltip} + + + ) : null}