Hide unread dot while worktrees are working (#6296)

This commit is contained in:
Brennan Benson 2026-06-24 14:37:07 -07:00 committed by GitHub
parent 75545ff09d
commit ce2a9a8de2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 51 additions and 1 deletions

View File

@ -84,6 +84,53 @@ describe('WorktreeCardStatusSlot', () => {
expect(markup).not.toContain('text-amber-500')
})
it('suppresses the new-card unread badge while unread status is working', () => {
mocks.status = 'working'
const markup = renderToStaticMarkup(
<WorktreeCardStatusSlot
worktreeId="wt-1"
showStatus
showUnreadAction
isUnread
unreadTooltip="Mark as read"
onPointerDown={vi.fn()}
onToggleUnread={vi.fn()}
newCardStyle
hasBranchIdentity={false}
/>
)
expect(markup).toContain('Working · Unread')
expect(markup).toContain('border-yellow-500')
expect(markup).not.toContain('data-worktree-status-lane-unread=""')
expect(markup).not.toContain('data-worktree-unread-alert=""')
expect(markup).not.toContain('aria-label="Mark as read"')
expect(markup).not.toContain('lucide-bell')
expect(markup).not.toContain('text-amber-500')
})
it('keeps legacy unread working cards on the unread bell control', () => {
mocks.status = 'working'
const markup = renderToStaticMarkup(
<WorktreeCardStatusSlot
worktreeId="wt-1"
showStatus
showUnreadAction
isUnread
unreadTooltip="Mark as read"
onPointerDown={vi.fn()}
onToggleUnread={vi.fn()}
/>
)
expect(markup).toContain('aria-label="Mark as read"')
expect(markup).toContain('Mark as read')
expect(markup).toContain('Working')
expect(markup).toContain('text-amber-500')
expect(markup).not.toContain('border-yellow-500')
expect(markup).not.toContain('data-worktree-unread-alert=""')
})
it('shows status in the unread toggle affordance', () => {
const markup = renderToStaticMarkup(
<WorktreeCardStatusSlot

View File

@ -121,6 +121,9 @@ export function WorktreeCardStatusSlot({
: statusLabel
const passiveStatusTooltip =
newCardStyle && isUnread ? `${passiveStatusLabel} · Unread` : passiveStatusLabel
// Why: the working spinner owns the new-card status lane, but unread state
// should still surface in tooltip/sr-only copy and reappear afterward.
const showNewCardUnreadAlert = newCardStyle && isUnread && showStatus && status !== 'working'
const reviewStatusIconClassName = compactReviewAndBranchStatusIconClassName
const branchStatusIcon = <GitBranch className={branchStatusIconClassName} aria-hidden="true" />
const passiveStatus =
@ -173,7 +176,7 @@ export function WorktreeCardStatusSlot({
}
if (!unreadActionEnabled) {
return overlayNewCardUnreadStatus(passiveStatus, newCardStyle && isUnread && showStatus)
return overlayNewCardUnreadStatus(passiveStatus, showNewCardUnreadAlert)
}
const actionLabel = isUnread ? 'Mark as read' : 'Mark as unread'