diff --git a/src/renderer/components/team/members/MemberDraftRow.test.tsx b/src/renderer/components/team/members/MemberDraftRow.test.tsx index 44f77a25..824d619a 100644 --- a/src/renderer/components/team/members/MemberDraftRow.test.tsx +++ b/src/renderer/components/team/members/MemberDraftRow.test.tsx @@ -96,15 +96,6 @@ vi.mock('@renderer/components/ui/MentionableTextarea', () => ({ MentionableTextarea: () => React.createElement('textarea'), })); -vi.mock('@renderer/components/ui/tooltip', () => ({ - Tooltip: ({ children }: { children: React.ReactNode }) => - React.createElement(React.Fragment, null, children), - TooltipTrigger: ({ children }: { children: React.ReactNode }) => - React.createElement(React.Fragment, null, children), - TooltipContent: ({ children }: { children: React.ReactNode }) => - React.createElement('div', null, children), -})); - vi.mock('@renderer/hooks/useDraftPersistence', () => ({ useDraftPersistence: ({ initialValue }: { initialValue?: string }) => ({ value: initialValue ?? '', @@ -253,6 +244,29 @@ describe('MemberDraftRow', () => { }); }); + it('renders worktree isolation help without a Radix tooltip trigger', () => { + const { host, root } = renderMemberDraftRow({ + showWorktreeIsolationControls: true, + worktreeIsolationDisabledReason: 'Worktree isolation is disabled for this project.', + }); + + const worktreeControl = host.querySelector( + '#member-member-1-worktree-isolation' + )!; + const descriptionId = 'member-member-1-worktree-isolation-description'; + const wrapper = worktreeControl.closest('[title]'); + + expect(worktreeControl.getAttribute('aria-describedby')).toBe(descriptionId); + expect(wrapper?.getAttribute('title')).toBe('Worktree isolation is disabled for this project.'); + expect(host.querySelector(`#${descriptionId}`)?.textContent).toBe( + 'Worktree isolation is disabled for this project.' + ); + + act(() => { + root.unmount(); + }); + }); + it('warns custom Anthropic Sonnet teammates about plan/runtime billing when 200K limit is off', () => { const { host, root } = renderMemberDraftRow({ member: { diff --git a/src/renderer/components/team/members/MemberDraftRow.tsx b/src/renderer/components/team/members/MemberDraftRow.tsx index 07e8450f..3c0b9035 100644 --- a/src/renderer/components/team/members/MemberDraftRow.tsx +++ b/src/renderer/components/team/members/MemberDraftRow.tsx @@ -15,7 +15,6 @@ import { Checkbox } from '@renderer/components/ui/checkbox'; import { Input } from '@renderer/components/ui/input'; import { Label } from '@renderer/components/ui/label'; import { MentionableTextarea } from '@renderer/components/ui/MentionableTextarea'; -import { Tooltip, TooltipContent, TooltipTrigger } from '@renderer/components/ui/tooltip'; import { getTeamColorSet } from '@renderer/constants/teamColors'; import { useDraftPersistence } from '@renderer/hooks/useDraftPersistence'; import { useFileListCacheWarmer } from '@renderer/hooks/useFileListCacheWarmer'; @@ -234,6 +233,13 @@ export const MemberDraftRow = ({ : undefined; const worktreeIsolationDisabled = isRemoved || Boolean(worktreeIsolationDisabledReason && member.isolation !== 'worktree'); + const worktreeIsolationDescription = + worktreeIsolationDisabledReason && member.isolation !== 'worktree' + ? worktreeIsolationDisabledReason + : 'Run this teammate in a separate git worktree. Apply/reject changes targets that worktree, not the lead workspace.'; + const worktreeIsolationDescriptionId = showWorktreeIsolationControls + ? `member-${member.id}-worktree-isolation-description` + : undefined; const effectiveModelKey = effectiveModel?.trim() ?? ''; const selectedModelIssueText = effectiveModelKey && modelIssueReasonByProvider?.[effectiveProviderId]?.[effectiveModelKey] @@ -393,40 +399,39 @@ export const MemberDraftRow = ({ ) : null} {showWorktreeIsolationControls ? ( - - -
+
+ + onWorktreeIsolationChange?.(member.id, checked === true) + } + /> +
- - - {worktreeIsolationDisabledReason && member.isolation !== 'worktree' - ? worktreeIsolationDisabledReason - : 'Run this teammate in a separate git worktree. Apply/reject changes targets that worktree, not the lead workspace.'} - - + + Worktree + +
+ + {worktreeIsolationDescription} + + ) : null} {hideActionButton ? null : isRemoved ? (