Clarify detached commits and deletion guidance

This commit is contained in:
Jinjing
2026-11-08 19:32:10 -08:00
parent b6a60d3bf9
commit 6aa4f95cf0
3 changed files with 23 additions and 3 deletions
@@ -54,7 +54,18 @@ export function NativeChatComposerWorkspace({
} = useAppStore(useShallow(selector))
const identity = getWorktreeGitIdentityDisplay({ branch, head })
const label = identity?.kind === 'branch' ? identity.branchName : identity?.sourceControlLabel
const label =
identity?.kind === 'branch'
? identity.branchName
: identity
? t(
'components.native-chat.composerWorkspace.detachedCommit',
'Commit {{head}} (not a branch)',
{
head: identity.shortHead
}
)
: undefined
const identityCopyValue = identity?.kind === 'branch' ? identity.branchName : head
const copyValue = async (value: string | undefined): Promise<void> => {
if (!value) {
@@ -99,7 +110,7 @@ export function NativeChatComposerWorkspace({
</Button>
</TooltipTrigger>
<TooltipContent side="top" sideOffset={4}>
{label}
{identity.kind === 'detached' ? identity.tooltip : label}
</TooltipContent>
</Tooltip>
) : null
@@ -1,3 +1,4 @@
import { useId } from 'react'
import { Trash2 } from 'lucide-react'
import { DropdownMenuItem, DropdownMenuShortcut } from '@/components/ui/dropdown-menu'
import { useOptionalShortcutLabel } from '@/hooks/useShortcutLabel'
@@ -6,6 +7,7 @@ import type { WorktreeContextMenuModel } from './use-worktree-context-menu-model
export function WorktreeContextMenuDeleteItems({ model }: { model: WorktreeContextMenuModel }) {
const t = useTranslate()
const primaryDeleteDescriptionId = useId()
const deleteShortcut = useOptionalShortcutLabel('workspace.delete')
const {
batchDeleteWorktrees,
@@ -42,7 +44,10 @@ export function WorktreeContextMenuDeleteItems({ model }: { model: WorktreeConte
<Trash2 className="size-3.5" />
{t('auto.components.sidebar.WorktreeContextMenu.deleteWorktree', 'Delete Worktree')}
</DropdownMenuItem>
<p className="max-w-64 px-2 py-1.5 text-xs text-muted-foreground">
<p
id={primaryDeleteDescriptionId}
className="max-w-64 px-2 py-1.5 text-xs text-muted-foreground"
>
{t(
'auto.components.sidebar.WorktreeContextMenu.primaryDeleteDisabled',
"Primary worktree — can't be deleted. Remove the project instead."
@@ -53,6 +58,9 @@ export function WorktreeContextMenuDeleteItems({ model }: { model: WorktreeConte
{/* Use Radix’s direct title prop for project-removal copy; wrapper elements break flat roving-keyboard navigation. */}
<DropdownMenuItem
variant="destructive"
aria-describedby={
!isMultiContext && removesProject ? primaryDeleteDescriptionId : undefined
}
onSelect={handleDelete}
disabled={
contextDeletePending ||
+1
View File
@@ -20772,6 +20772,7 @@
"composerWorkspace": {
"copyFailed": "Failed to copy",
"copyIdentity": "Copy {{value0}}",
"detachedCommit": "Commit {{head}} (not a branch)",
"folder": "Folder",
"mainCheckout": "Main checkout",
"turnWorking": "This chat's agent is working. Switch branches after its turn finishes.",