Skip to content

feat(focus-mode): collapse the title-bar pill strip to current/total past 12 items - #384

Open
truongthinh1412 wants to merge 5 commits into
johannesjo:mainfrom
truongthinh1412:feat/focus-strip-collapse
Open

truongthinh1412 wants to merge 5 commits into
johannesjo:mainfrom
truongthinh1412:feat/focus-strip-collapse

Conversation

@truongthinh1412

Copy link
Copy Markdown
Contributor

Description

Implements item 5 of #212 ("Focus mode wayfinding") — per the audit's prescription: "Collapse the dot strip to 'current/total' text past ~12 tasks."

With ≤12 open items the title-bar strip behaves exactly as today (one named pill per item). Past 12, it collapses to a single compact pill showing current / total (e.g. 3 / 13), because the pills otherwise clip silently against the title bar's reserved padding (the container is overflow: hidden with fixed control-space padding). Details:

  • The compact pill reuses the existing focus-mode-task-indicator class, so it inherits the drag carve-out (pointer-events: auto + -webkit-app-region: no-drag), hover, and focus-visible styles — no CSS changes needed. onMouseDown stopPropagation is retained.
  • It is a native button with aria-current="true" and title/aria-label carrying the active item's name and position ("Task X, current item (3 of 13)"); clicking re-activates the current item, same semantics as the old active pill (activateTaskFromPointer).
  • When no active item is in the open order (task closed/collapsed or filtered out), the strip falls back to the un-collapsed pills rather than inventing a display state; the board-view gate is untouched.
  • The threshold (12) is a module-local constant; the boundary is covered behaviorally (12 → pills, 13 → compact pill).

Tests: a new FocusModeTaskIndicators.client.test.tsx (5 tests — the component had none) covering the 12/13 boundary, compact content/classes/aria, click observability via store.sidebarFocused, both fallback edge cases, and board view, following the TaskBoard.client.test.tsx fixture idiom.

Scope note: items 1 and 3 of #212 are already on main; items 2 and 4 remain open, so this does not auto-close the issue.

Issues Resolved

Part of #212 (implements item 5; issue stays open for items 2 and 4)

Check List

  • New functionality includes testing.
  • New functionality has been documented in the README if applicable. (Not applicable — UI behavior addition, no user-facing configuration.)

@johannesjo

Copy link
Copy Markdown
Owner

🔍 Reviewed – no blocking issues found at 60eac71.

Thanks for the PR! This collapses the focus-mode title-bar strip to a single "name · current / total" pill past 12 open items, as item 5 of #212 asks. The boundary, the fallback when the active item is not in the strip, and board view are all covered by the new tests.

Nits

  • src/components/FocusModeTaskIndicators.tsx:72 – the compact pill drops the active task's StatusDot, while that task's pill in the uncollapsed strip (line 56) shows it. So going from 12 to 13 items also hides the current task's own status glyph, e.g. a needs-input dot. Consider rendering the same <StatusDot status={getTaskDotStatus(id)} taskId={id} size="sm" attention={getTaskAttentionState(id)} /> before the name span when store.tasks[store.activeTaskId] exists.

Automated review pass (Claude Code). Anything unclear or wrong – say so and I'll take a look.

@johannesjo

Copy link
Copy Markdown
Owner

This fits #212 well. On the two open points:

  1. Past 12 tasks, the compact pill should still show when another task needs attention, e.g. a small "2 need input" hint or the attention dot on the pill. Otherwise a blocked agent is invisible with the sidebar collapsed.
  2. Clicking the compact pill should open the Cmd+K task switcher, so the title bar can still switch tasks. Its open state lives in App.tsx (openTaskSwitcher), so it needs a little plumbing.

Could you add both? I'll take another look after that.

@truongthinh1412

Copy link
Copy Markdown
Contributor Author

yes ill get on this

@truongthinh1412

Copy link
Copy Markdown
Contributor Author

Thanks so much for the detailed review and for the two follow-up suggestions — really appreciate the guidance! 🙏

Both points, plus the StatusDot nit, are addressed in a12137e3:

  1. Status glyph kept — the compact pill now renders the active task's StatusDot (same props as the uncollapsed pill), so crossing from 12 → 13 items no longer hides a needs-input/error badge.
  2. Attention hint — other open tasks that are blocked on input or failed (needs_input/error, the same pair as the board's "needs you" filter) now show a small · N need attention hint on the pill, folded into its title/aria-label too. The active task is excluded since its own glyph is already on the pill.
  3. Click opens the switcher — clicking the compact pill now opens the Cmd+K task switcher. App.tsx passes onOpenTaskSwitcher into both title-bar paths (directly on macOS, through WindowTitleBar elsewhere); without an opener plumbed (tests/bare hosts) the pill keeps its previous re-activate behaviour.

Verified locally: npm run check passes, the FocusModeTaskIndicators client tests cover the glyph, the hint (including the active-task exclusion), the switcher click, and the 12/13 boundary — and I ran the app with 13 open tasks to eyeball the pill. Happy to adjust the hint wording or the exact attention definition if you'd prefer something narrower — just say the word. Thanks again for taking a look! 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants