MCPcopy Index your code
hub / github.com/codeaashu/claude-code / stepTeammateSelection

Function stepTeammateSelection

src/hooks/useBackgroundTaskNavigation.ts:26–59  ·  view source on GitHub ↗
(
  delta: 1 | -1,
  setAppState: (updater: (prev: AppState) => AppState) => void,
)

Source from the content-addressed store, hash-verified

24// Step teammate selection by delta, wrapping across leader(-1)..teammates(0..n-1)..hide(n).
25// First step from a collapsed tree expands it and parks on leader.
26function stepTeammateSelection(
27 delta: 1 | -1,
28 setAppState: (updater: (prev: AppState) => AppState) => void,
29): void {
30 setAppState(prev => {
31 const currentCount = getRunningTeammatesSorted(prev.tasks).length
32 if (currentCount === 0) return prev
33
34 if (prev.expandedView !== 'teammates') {
35 return {
36 ...prev,
37 expandedView: 'teammates' as const,
38 viewSelectionMode: 'selecting-agent',
39 selectedIPAgentIndex: -1,
40 }
41 }
42
43 const maxIdx = currentCount // hide row
44 const cur = prev.selectedIPAgentIndex
45 const next =
46 delta === 1
47 ? cur >= maxIdx
48 ? -1
49 : cur + 1
50 : cur <= -1
51 ? maxIdx
52 : cur - 1
53 return {
54 ...prev,
55 selectedIPAgentIndex: next,
56 viewSelectionMode: 'selecting-agent',
57 }
58 })
59}
60
61/**
62 * Custom hook that handles Shift+Up/Down keyboard navigation for background tasks.

Callers 1

handleKeyDownFunction · 0.85

Calls 1

Tested by

no test coverage detected