]*data-worktree-hover-identity-header=""[^>]*>/)?.[0] ?? ''
+
+ expect(identityHeaderTag).not.toContain('border-l')
+ expect(identityHeaderTag).not.toContain('pl-2')
+ expect(markup).toContain('data-worktree-title-inline-rename=""')
+ expect(markup).toContain('Fix stale GH PR')
+ expect(markup).toContain('border-l border-border/70 pl-3')
+ })
+
it('puts unlink behind the first PR actions menu and keeps GitHub last', () => {
const markup = renderToStaticMarkup(
{
+ setWorkspaceTitleEditing(editing)
+ onWorkspaceTitleEditingChange?.(editing)
+ if (!editing && pendingWorkspaceTitleCloseRef.current) {
+ pendingWorkspaceTitleCloseRef.current = false
+ handleHoverOpenChange(false)
+ }
+ },
+ [handleHoverOpenChange, onWorkspaceTitleEditingChange]
+ )
+ const handleEffectiveHoverOpenChange = React.useCallback(
+ (next: boolean): void => {
+ if (!next && workspaceTitleEditing) {
+ pendingWorkspaceTitleCloseRef.current = true
+ return
+ }
+ pendingWorkspaceTitleCloseRef.current = false
+ handleHoverOpenChange(next)
+ },
+ [handleHoverOpenChange, workspaceTitleEditing]
+ )
const dismissAndRun = React.useCallback(
(handler: ((event: React.MouseEvent) => void) | undefined) => (event: React.MouseEvent) => {
closeHover()
@@ -219,34 +247,10 @@ export function WorktreeCardDetailsHover({
return children
}
- const branchIdentity = branchName ? (
-
- {branchName}
-
- ) : null
- const workspaceIdentity =
- workspaceTitle && workspaceTitle !== branchName ? (
-
- {workspaceTitle}
-
- ) : null
-
return (
@@ -262,12 +266,14 @@ export function WorktreeCardDetailsHover({
>
{showIdentityHeader && (
-
- {/* Why: the closed card no longer carries a branch row; custom-titled
- worktrees still need their git branch available in the hover. */}
- {identityOrder === 'branch-first' ? branchIdentity : workspaceIdentity}
- {identityOrder === 'branch-first' ? workspaceIdentity : branchIdentity}
-
+
)}
React.ReactElement
+ wrapTitle?: boolean
onEditingChange?: (editing: boolean) => void
onRename: (displayName: string) => Promise | void
// Why: lets a parent (e.g. the workspace.rename shortcut via WorktreeCard)
@@ -53,6 +54,7 @@ export function WorktreeTitleInlineRename({
editingClassName,
inputClassName,
titleWrapper,
+ wrapTitle = false,
onEditingChange,
onRename,
beginEditing = false,
@@ -288,7 +290,8 @@ export function WorktreeTitleInlineRename({
key={`title:${titleElementKey}`}
ref={handleRootRef}
className={cn(
- 'block min-w-0 truncate leading-tight focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-worktree-sidebar-ring',
+ 'block min-w-0 leading-tight focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-worktree-sidebar-ring',
+ wrapTitle ? 'break-words whitespace-normal' : 'truncate',
titleEmphasisClassName,
className
)}
@@ -310,7 +313,7 @@ export function WorktreeTitleInlineRename({
return titleWrapper(title)
}
- if (!titleTruncated) {
+ if (wrapTitle || !titleTruncated) {
return title
}
diff --git a/src/renderer/src/components/sidebar/worktree-card-meta-types.ts b/src/renderer/src/components/sidebar/worktree-card-meta-types.ts
index f0393848db6..faf61492483 100644
--- a/src/renderer/src/components/sidebar/worktree-card-meta-types.ts
+++ b/src/renderer/src/components/sidebar/worktree-card-meta-types.ts
@@ -37,10 +37,13 @@ export type WorktreeCardDetailsHoverProps = WorktreeCardMetaBadgesProps & {
branchName?: string
workspaceTitle?: string
identityOrder?: 'workspace-first' | 'branch-first'
+ workspaceTitleRenameDisabled?: boolean
automationHostId?: ExecutionHostId
detailsAfter?: React.ReactNode
openDelay?: number
closeDelay?: number
+ onRenameWorkspaceTitle?: (displayName: string) => Promise | void
+ onWorkspaceTitleEditingChange?: (editing: boolean) => void
onEditIssue?: (event: React.MouseEvent) => void
onEditComment?: (event: React.MouseEvent) => void
onOpenGitHubIssueInOrca?: (event: React.MouseEvent) => void